Trait ark_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

Required Associated Constants§

source

const BIT_SIZE: usize

The number of bits required to encode Self. This should be at most 8.

Required Methods§

source

fn u8_bitmask(&self) -> u8

source

fn from_u8(value: u8) -> Option<Self>

Provided Methods§

source

fn from_u8_remove_flags(value: &mut u8) -> Option<Self>

Object Safety§

This trait is not object safe.

Implementors§