macro_rules! delegate_resource_traits {
(delegate impl ExtraCfgCarrier to $inner: ident on $type: ident;) => { ... };
(delegate impl ResourceConfig to $inner: ident on $type: ident;) => { ... };
($(delegate $($trait: ident),* to $inner: ident on $type: ident;)*) => { ... };
}
Expand description
Delegates listed traits into a field.
If a trait is implemented for a field of a type, this allows for implementing it on the container too by delegating it to the field. This is limited to these traits:
Examples
#[macro_use]
extern crate spirit_tokio;
// This one is trivial ‒ the real one would actually add some functionality or fields.
#[derive(Debug, Eq, PartialEq)]
struct Wrapper<Inner> {
inner: Inner,
}
delegate_resource_traits! {
delegate ExtraCfgCarrier, ResourceConfig to inner on Wrapper;
}