3 releases
new 0.1.2 | Mar 28, 2025 |
---|---|
0.1.1 | Mar 28, 2025 |
0.1.0 | Mar 7, 2025 |
#570 in Procedural macros
121 downloads per month
3KB
#[inherits(Type)]
This attribute macro achieves inheritance-like effects through the Deref
and DerefMut
traits, simplifying the application of the composition pattern in Rust.
A struct annotated with #[inherit(T)]
will implicitly contain a parent
field of type T
, enabling single inheritance behavior.
For disambiguated access to fields with the same name, use (&<name> as &<type>).<field>
or (&mut <name> as &mut <type>).<field>
syntax.
Dependencies
~200–630KB
~15K SLoC