Skip to main content

delegate_subcommand

Macro delegate_subcommand 

Source
macro_rules! delegate_subcommand {
    ($_Self:expr => | $arg:ident | $($Rest:tt)*) => { ... };
    ($_Self:tt $($Rest:tt)*) => { ... };
}
Expand description

This macro was generated by an invocation of delegated_enum.

Performs delegation of the enum by applying the same expression to all variants of the enum.

This macro is used in code generated by invocations of delegate_impl, though nothing stops you from using it manually.

§This macro accepts 2 different syntaxes:

// Simple
`delegate_subcommand!{ enum_variable.method_name(comma,separated,method,args).continue_with_any_rust_expression() }`

// Closure 
`delegate_subcommand!{ enum_variable => |arg| any_rust_expression_that_uses_arg_parameter() }`

§Example:

impl Clone for Subcommand {
            fn clone(&self) -> Self {
                delegate_subcommand! { self.clone() }
            }
}