[][src]Macro pui::make_typeid

macro_rules! make_typeid {
    ($(#[$meta:meta])*$v:vis once type $ident:ident;) => { ... };
    ($(#[$meta:meta])*$v:vis type $ident:ident;) => { ... };
}

Create a new type that can be used with typeid::Type

calling make_typeid like so,

pui::make_typeid! {
    once type OnceThreadLocal;
}

will desugar to something like

struct OnceThreadLocal;

impl OnceThreadLocal {
    pub fn new() -> pui::typeid::Type<Self> {
        Self::try_new().unwrap()
    }

    pub fn try_new() -> Option<pui::typeid::Type<Self>> {
        // implementation details
    }
}

You can use OnceThreadLocal::new() to create a new thread local identifier instance if you are sure there are no other instances active, otherwise use OnceThreadLocal::try_new()