derive_macro

Macro derive_macro 

Source
macro_rules! derive_macro {
    (($name:ident $(, $attr:tt)*) -> use $func:ident) => { ... };
    (($name:ident, attributes($($attr:ident),*)) -> use $func:ident) => { ... };
    (($name:ident $(, $attr:tt)*) -> use $module:ident :: $func:ident) => { ... };
    (($name:ident, attributes($($attr:ident),*)) -> use $module:ident :: $func:ident) => { ... };
    (($name:ident $(, $attr:tt)*) -> use $($module:ident)::+ :: $func:ident) => { ... };
    (($name:ident, attributes($($attr:ident),*)) -> use $($module:ident)::+ :: $func:ident) => { ... };
    (($name:ident $(, $attr:tt)*) -> $func:ident) => { ... };
    (($name:ident, attributes($($attr:tt),*)) -> $func:ident) => { ... };
    (($name:ident $(, $attr:tt)*) -> mod $module:ident :: $func:ident) => { ... };
    (($name:ident, attributes($($attr:tt),*)) -> mod $module:ident :: $func:ident) => { ... };
    (($name:ident $(, $attr:tt)*) -> $module:ident :: $func:ident) => { ... };
    (($name:ident, attributes($($attr:tt),*)) -> $module:ident :: $func:ident) => { ... };
    (($name:ident $(, $attr:tt)*) -> mod $first:ident $(:: $rest:ident)+ :: $func:ident) => { ... };
    (($name:ident, attributes($($attr:tt),*)) -> mod $first:ident $(:: $rest:ident)+ :: $func:ident) => { ... };
    (($name:ident $(, $attr:tt)*) -> $first:ident $(:: $rest:ident)+ :: $func:ident) => { ... };
    (($name:ident, attributes($($attr:tt),*)) -> $first:ident $(:: $rest:ident)+ :: $func:ident) => { ... };
    (($name:ident $(, $attr:tt)*) -> $path:literal :: $func:ident) => { ... };
    (($name:ident $(, $attr:tt)*) -> @$path:literal :: $func:ident) => { ... };
}
Expand description

Defines and delegates a derive macro from another module.

ยงUsage patterns:

  • Already in scope: derive_macro!(Name -> function)
  • Module reference: derive_macro!(Name -> module::function)
  • Nested modules: derive_macro!(Name -> a::b::c::function)
  • Literal path: derive_macro!(Name -> "path/to/file.rs"::function)
  • Crate-relative path: derive_macro!(Name -> @"path/from/crate/root.rs"::function)
  • With attributes: derive_macro!((Name, attributes(attr1, attr2)) -> module::function)

See: macros!