#[derive(OneHot)]
{
// Attributes available to this derive:
#[onehot]
}
Expand description
The auto derive macro for OneHot.
Enums and structs:
ⓘ
#[derive(OneHot)]
pub enum SimpleEnum {
First,
Second,
#[onehot(ignore)] // Fields with the `ignore` attribute are disconsidered.
Third,
}
#[derive(OneHot)]
struct SimpleStruct {
f1: bool,
f2: SimpleEnum,
}Structs can also be tuple and/or generic:
ⓘ
#[derive(OneHot)]
pub struct SimpleGenericStruct<'a, T: OneHot + 'a>(
bool,
&'a T,
#[onehot(ignore)] u32
);