Skip to content
A catalogue of Rust design patterns
Branch: master
Clone or download

Latest commit

Manishearth Merge pull request #92 from kinseytamsin/question-mark-op
Rewrite mentions of `try!` macro to use `?` operator
Latest commit 41bfd4d Feb 23, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
anti_patterns Type fix Sep 28, 2019
idioms Rewrite mentions of `try!` macro to use `?` operator Feb 6, 2020
patterns Merge pull request #75 from llogiq/unsafe-mods Aug 1, 2019
LICENSE Initial commit Aug 30, 2015
README.md Merge pull request #75 from llogiq/unsafe-mods Aug 1, 2019
intro.md Initial commit Aug 30, 2015
template.md Added a few idioms and patterns - some are still WIP Oct 22, 2015

README.md

Rust Design Patterns

An open source repository of design patterns and idioms in the Rust programming language.

Contents

Introduction

Idioms

Design patterns

Anti-patterns

  • TODO thread + catch_panic for exceptions
  • TODO Clone to satisfy the borrow checker
  • Deref polymorphism
  • TODO Matching all fields of a struct (back compat)
  • TODO wildcard matches
  • TODO taking an enum rather than having multiple functions
  • TODO unwrap()ing every Result instead of forwarding it
  • #[deny(warnings)]

Contributing

Contributions are very welcome!

You should start with the template. Copy it into the appropriate directory, edit it, and submit a PR. You might not want every section, and you might want to add extra sections.

We suggest leaving a comment on the issue tracker so that other people don't start working on the same topic.

Correction and elaboration PRs are very welcome.

You can’t perform that action at this time.