Macro unique_type::new
source · [−]macro_rules! new {
() => { ... };
}
Expand description
Generates a unique type that implements the Unique
trait
Example
Calling this macro twice will always generate two different types, thus this will panic:
ⓘ
assert_eq!(
TypeId::of::<unique_type::new!()>(),
TypeId::of::<unique_type::new!()>()
);
And this won’t even compile:
ⓘ
let a: unique_type::new!() = todo!();
let b: unique_type::new!() = a;