Derive Macro proc_bitfield::ConvRaw
source · #[derive(ConvRaw)]Expand description
A derive macro to implement any applicable conversion traits between an enum and the builtin integer types corresponding to variant discriminants.
§Usage example
#[derive(ConvRaw)]
pub enum ConvRawExample {
A,
B = 2,
C,
D = -1,
E = 1,
F = -128,
G = 128,
}This will implement:
TryFrom<T> for ConvRawExamplefor all integer typesTUnsafeFrom<T> for ConvRawExamplefor all integer typesTFrom<ConvRawExample> for Tfor all integer typesTthat contain all discriminants; in this case, all signed integer types with>= 16bits (i16,i32,i64,i128)