delegatemethod-rs
Delegate method calls to a field.
What's new in 0.2.0
A total rearrange of code.
Now we support generic parameters of methods.
This comes at the price that now we generate the whole impl instead of impl items.
You have to put the whole impl inside the macro now.
Examples
Suppose you have a struct called Inner
, with methods fn1
and fn2
.
You have another struct called Outer
with fields using Inner
as type.
You can use delegate_method
to forward some method implementations to the fields.
delegate_method!
Acknowledgements
- The idea comes from Tommy McGuire's blog, but adjusted to match the Rust syntax better.