[][src]Macro pui_core::make_type_id

macro_rules! make_type_id {
    () => { ... };
    (
        $(#[$meta:meta])*
        $v:vis let $name:ident;
    ) => { ... };
    (
        $(#[$meta:meta])*
        $v:vis static $name:ident;
    ) => { ... };
}

Create a new Type<T>

Two calls to scope will never return the same type (the difference is in the types)

let a = pui_core::make_type_id!();
let b = pui_core::make_type_id!();
assert_eq!(a, b);
let a = pui_core::make_type_id!();
assert_eq!(a, a);

You can also declare your own unit struct that that will be used to generate a Type. Note: this can only be used in positions where let bindings are valid.

pui_core::make_type_id! {
    /// Documentation for Foo
    #[derive(Debug, Clone, Copy)]
    pub let Foo;
}

let token = Foo.token();

Or in positions where static is valid.

pui_core::make_type_id! {
    /// Documentation for Foo
    #[derive(Debug, Clone, Copy)]
    pub static Foo;
}

let token = Foo.token();