Go to file
wangcong 66ce03a774
Fix wording in "Fold" pattern (#69)
Co-authored-by: Chris Wong <lambda.fairy@gmail.com>
2021-01-01 14:23:29 +01:00
.github/workflows add ci (#115) 2021-01-01 12:49:45 +01:00
anti_patterns Adding mdbook configuration and deployment to gh-pages (#111) 2021-01-01 12:27:42 +01:00
idioms Adding mdbook configuration and deployment to gh-pages (#111) 2021-01-01 12:27:42 +01:00
patterns Fix wording in "Fold" pattern (#69) 2021-01-01 14:23:29 +01:00
.env Adding mdbook configuration and deployment to gh-pages (#111) 2021-01-01 12:27:42 +01:00
.gitignore Adding mdbook configuration and deployment to gh-pages (#111) 2021-01-01 12:27:42 +01:00
book.toml Adding mdbook configuration and deployment to gh-pages (#111) 2021-01-01 12:27:42 +01:00
intro.md Initial commit 2015-08-31 10:06:10 +12:00
LICENSE Initial commit 2015-08-31 10:06:10 +12:00
README.md Adding mdbook configuration and deployment to gh-pages (#111) 2021-01-01 12:27:42 +01:00
SUMMARY.md Adding mdbook configuration and deployment to gh-pages (#111) 2021-01-01 12:27:42 +01:00
template.md Added a few idioms and patterns - some are still WIP 2015-10-23 09:53:16 +13:00

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.

Building with mdbook

This book is built with mdbook. You can install it by running cargo install mdbook.

If you want to build it locally you can run one of these two commands in the root directory of the repository:

  • mdbook build

    Builds static html pages as output and place them in the /book directory by default.

  • mdbook serve

    Serves the book at http://localhost:3000 (port is changeable, take a look at the terminal output to be sure) and reloads the browser when a change occurs.