Macro define_tag

Source
macro_rules! define_tag {
    {} => { ... };
    {
        $(#$attr:tt)*
        $vis:vis tag $Name:ident $(<$($T:ident),* $(,)?>)? : for<$($lt:lifetime),* $(,)?> $T1:ty $( => $T2:ty )? ;
        $($rest:tt)*
    } => { ... };
    {
        $(#$attr:tt)*
        $vis:vis tag $Name:ident < $($rest:tt)*
    } => { ... };
    {
        $(#$attr:tt)*
        $vis:vis tag $Name:ident : $($rest:tt)*
    } => { ... };
}
Expand description

Declares one or more ResourceTag implementations.

use core::ops::Deref;

define_tag! {
    /// Tag describing a numeric status code.
    pub tag StatusCode: i32;

    /// Tag describing a pair of references to `T` and the target of `U`.
    pub tag RefPair<T, U>: for<'x> (&'x T, &'x U::Target) where U: Deref;

    /// Tag for retrieving a reference given a string slice.
    pub tag GetRefByName<T: ?Sized>: for<'data, 'request> &'request str => &'data T;
}