Trait snarkvm_utilities::serialize::Flags [−][src]
pub trait Flags: Default + Clone + Copy + Sized { fn u8_bitmask(&self) -> u8; fn from_u8(value: u8) -> Self; fn num_bits() -> usize; fn from_u8_remove_flags(value: &mut u8) -> Self { ... } }
Expand description
Serialization flags.
Required methods
fn u8_bitmask(&self) -> u8
fn u8_bitmask(&self) -> u8
Returns a bit mask corresponding to self
.
For example, if Self
contains two variants, then there are two possible bit masks:
0
and 1 << 7
.
Provided methods
fn from_u8_remove_flags(value: &mut u8) -> Self
fn from_u8_remove_flags(value: &mut u8) -> Self
Convenience method that reads Self
from value
, just like Self::from_u8
,
but additionally zeroes out the bits corresponding to the resulting flag in value
.