Crate derived[][src]

Expand description

derived: A macro to automate the boring stuff

The derived crate aims to provide macros to automate boring things like writing functions for constructors. Just look at the list of available macros and you’ll find an example for each.


  • Ctor: To generate constructors
  • Gtor: To generate getters
  • Stor: To generate setters
  • Constdef: To generate constant, compile-time default implementations
  • Full lifetimes, generics and where clause support
  • Use the gtor attribute to get either immutable or mutable or both references (see example below)
  • Skip generation of setters or getters with the #[stor_skip] or #[gtor_skip] attributes for specific fields
  • Make ctors and gtors const with the #[ctor_const] and #[gtor_const] attributes
  • Skip ctors, gtors and stors for PhantomData fields with the #[phantom] attribute

Derive Macros

Constdef: Constant, compile-time default implementations

Ctor: Get a constructor derived

Gtor: Get the getters derived

Stor: Get the setters derived