delegate_to_variants

Macro delegate_to_variants 

Source
macro_rules! delegate_to_variants {
    ($self:ident, $method:ident $(, $arg:expr)*) => { ... };
}
Expand description

Delegate a method call to all enum variants.

This macro generates a match expression that delegates to the same method on each enum variant, eliminating boilerplate.

§Examples

impl UnifiedDependency {
    pub fn name(&self) -> &str {
        delegate_to_variants!(self, name)
    }
}