ark_serialize

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§