macro_rules! define_label {
    (
        $(#[$label_attr:meta])*
        $label_trait_name:ident,
        $interner_name:ident
    ) => { ... };
    (
        $(#[$label_attr:meta])*
        $label_trait_name:ident,
        $interner_name:ident,
        extra_methods: { $($trait_extra_methods:tt)* },
        extra_methods_impl: { $($interned_extra_methods_impl:tt)* }
    ) => { ... };
}
Expand description

Macro to define a new label trait

Example

define_label!(
    /// Documentation of label trait
    MyNewLabelTrait,
    MY_NEW_LABEL_TRAIT_INTERNER
);

define_label!(
    /// Documentation of another label trait
    MyNewExtendedLabelTrait,
    MY_NEW_EXTENDED_LABEL_TRAIT_INTERNER,
    extra_methods: {
        // Extra methods for the trait can be defined here
        fn additional_method(&self) -> i32;
    },
    extra_methods_impl: {
        // Implementation of the extra methods for Interned<dyn MyNewExtendedLabelTrait>
        fn additional_method(&self) -> i32 {
            0
        }
    }
);