Trait snarkvm_utilities::serialize::Flags
source · pub trait Flags: Default + Clone + Copy + Sized {
const BIT_SIZE: usize;
// Required methods
fn u8_bitmask(&self) -> u8;
fn from_u8(value: u8) -> Option<Self>;
// Provided method
fn from_u8_remove_flags(value: &mut u8) -> Option<Self> { ... }
}
Expand description
Represents metadata to be appended to an object’s serialization. For
example, when serializing elliptic curve points, one can
use a Flag
to represent whether the serialization is the point
at infinity, or whether the y
coordinate is positive or not.
These bits will be appended to the end of the point’s serialization,
or included in a new byte, depending on space available.
This is meant to be provided to CanonicalSerializeWithFlags
and
CanonicalDeserializeWithFlags