macro_rules! brand {
($name:ident, $inner:ty) => { ... };
($name:ident, $inner:ty, omit_display) => { ... };
(@impl $name:ident, $inner:ty, [display]) => { ... };
(@impl $name:ident, $inner:ty, []) => { ... };
}Expand description
Define a named branded newtype with standard derives.
Use brand!(Name, Inner, omit_display) for the same shape without a derived
Display (when you implement Display yourself).
ⓘ
brand!(UserId, u64);
// Produces:
// #[repr(transparent)]
// #[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
// pub struct UserId(pub u64);
// impl UserId { pub fn new(v: u64) -> Self { Self(v) }
// pub fn into_inner(self) -> u64 { self.0 } }