Skip to main content

BinaryField

Trait BinaryField 

Source
pub trait BinaryField<O: BitOrder, Ctx = ()>: Sized {
    type Error;

    // Required methods
    fn parse(bits: &BitSlice<u8, O>, ctx: &Ctx) -> Result<Self, Self::Error>;
    fn build(
        &self,
        bits: &mut BitSlice<u8, O>,
        ctx: &Ctx,
    ) -> Result<(), Self::Error>;
    fn bit_len(&self, ctx: &Ctx) -> usize;

    // Provided method
    fn to_bitvec(&self, ctx: &Ctx) -> Result<BitVec<u8, O>, Self::Error> { ... }
}

Required Associated Types§

Required Methods§

Source

fn parse(bits: &BitSlice<u8, O>, ctx: &Ctx) -> Result<Self, Self::Error>

Source

fn build( &self, bits: &mut BitSlice<u8, O>, ctx: &Ctx, ) -> Result<(), Self::Error>

Source

fn bit_len(&self, ctx: &Ctx) -> usize

Provided Methods§

Source

fn to_bitvec(&self, ctx: &Ctx) -> Result<BitVec<u8, O>, Self::Error>

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§