Ben Chuanlong Du's Blog

It is never too late to learn.

Design Pattern and Productivity for Rust

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

derive_more

derive_more adds `#[derive(x)] macros for more traits.

derive_builder

derive_builder provides Rust macro to automatically implement the builder pattern for arbitrary structs. A simple #[derive(Builder)] will generate a FooBuilder for your struct Foo with all setter-methods and a build method.

derive-adhoc

derive-adhoc allows you to write macros which are driven by Rust data structures, just like proc macro derive macros, but without having to wrestle with the proc macro system.

bon

bon is a Rust crate for generating compile-time-checked builders for functions and structs.

Design Patterns

Improve your Rust APIs with the type state pattern

Constraints on Types

Please refer to Constraints on Types in Rust for detailed discussions.

References

Comments