Accessors Derive Macro
Derive macro generating an impl for accessing the fields of a struct.
Use #[accessors(get, get_mut, set)] to defined which accessors you want to have on a field.
List of accessors param.
get: Generate a getter returning a reference.get_copy: Generate a getter returning a copy. (mutually exclusive with get)get_mut: Generate a mutable getter returning a mutable reference.set: Generate a setter.
Using #[accessors(...)] on a field will generate accessors for this specific field.
Using #[accessors(...)] on a struct will generate accessors for all field in the struct.
Examples
Example using accessors on fields only.
Example using accessors on struct.
Those two example are equivalent and will generate the same code: