impl-opaque
Declare struct fields and initializers in implementation area.
This macro tries to solve separation of field declarations, initializations and usages.
The opaque attribute generates struct declaration, struct constructor (new method) by collecting field declarations and initializers inside impl block.
This crate is no_std on runtime and requires alloc to build macro.
Features
- Declare fields inside method
- Declare fields inside impl block
- Convert constructor arguments into fields
- Declare struct and implement trait at once
- Pattern matching and early return for fields inside a method
Attributes below #[opaque] will be moved to struct declaration.
Attributes below #[field] and field!() will be moved to field declaration.
Attribute reference
Examples
See examples for simple example
License
This crate is licensed under MIT OR Apache-2.0