Best practices are haphazardly collected in best.
practice/
contains the following examples:
linkedlist.rs
: very simple linked list implementation to demonstrate thestruct
-impl
code pattern common in Rust (from abeinges too many lists book)recurrence.rs
: macros in Rust with recursion via the fibonacci sequenceconversion.rs
: practicingFrom
andInto
for conversion between typesstatemachine.rs
: Rust state machine pattern by Hoverbearcombinators.rs
: basic syntax and patterns for combinators (map
,and_then
)container.rs
:Box<T>
vsRc<T>
in the context of Trait dynamic dispatchpractice/serialization/
defines a basic JSON serializer with serde- generic code patterns
More Resources
The beginning of the substrate recipes provides some references to the common Rust libraries for concurrency/parallelization, asynchronous computation, and multithreading: