Trait bin_proto::BitField

source ·
pub trait BitField: Sized {
    // Required methods
    fn read(
        read: &mut dyn BitRead,
        byte_order: ByteOrder,
        ctx: &mut dyn Any,
        bits: u32
    ) -> Result<Self, Error>;
    fn write(
        &self,
        write: &mut dyn BitWrite,
        byte_order: ByteOrder,
        ctx: &mut dyn Any,
        bits: u32
    ) -> Result<(), Error>;
}
Expand description

A trait for variable-width bit-level co/dec.

WARNING: This trait can and often will ignore the endianness.

Required Methods§

source

fn read( read: &mut dyn BitRead, byte_order: ByteOrder, ctx: &mut dyn Any, bits: u32 ) -> Result<Self, Error>

source

fn write( &self, write: &mut dyn BitWrite, byte_order: ByteOrder, ctx: &mut dyn Any, bits: u32 ) -> Result<(), Error>

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl BitField for bool

source§

fn read( read: &mut dyn BitRead, _: ByteOrder, _: &mut dyn Any, bits: u32 ) -> Result<Self, Error>

source§

fn write( &self, write: &mut dyn BitWrite, _: ByteOrder, _: &mut dyn Any, bits: u32 ) -> Result<(), Error>

source§

impl BitField for i8

source§

fn read( read: &mut dyn BitRead, _: ByteOrder, _: &mut dyn Any, bits: u32 ) -> Result<Self, Error>

source§

fn write( &self, write: &mut dyn BitWrite, _: ByteOrder, _: &mut dyn Any, bits: u32 ) -> Result<(), Error>

source§

impl BitField for i16

source§

fn read( read: &mut dyn BitRead, _: ByteOrder, _: &mut dyn Any, bits: u32 ) -> Result<Self, Error>

source§

fn write( &self, write: &mut dyn BitWrite, _: ByteOrder, _: &mut dyn Any, bits: u32 ) -> Result<(), Error>

source§

impl BitField for i32

source§

fn read( read: &mut dyn BitRead, _: ByteOrder, _: &mut dyn Any, bits: u32 ) -> Result<Self, Error>

source§

fn write( &self, write: &mut dyn BitWrite, _: ByteOrder, _: &mut dyn Any, bits: u32 ) -> Result<(), Error>

source§

impl BitField for u8

source§

fn read( read: &mut dyn BitRead, _: ByteOrder, _: &mut dyn Any, bits: u32 ) -> Result<Self, Error>

source§

fn write( &self, write: &mut dyn BitWrite, _: ByteOrder, _: &mut dyn Any, bits: u32 ) -> Result<(), Error>

source§

impl BitField for u16

source§

fn read( read: &mut dyn BitRead, _: ByteOrder, _: &mut dyn Any, bits: u32 ) -> Result<Self, Error>

source§

fn write( &self, write: &mut dyn BitWrite, _: ByteOrder, _: &mut dyn Any, bits: u32 ) -> Result<(), Error>

source§

impl BitField for u32

source§

fn read( read: &mut dyn BitRead, _: ByteOrder, _: &mut dyn Any, bits: u32 ) -> Result<Self, Error>

source§

fn write( &self, write: &mut dyn BitWrite, _: ByteOrder, _: &mut dyn Any, bits: u32 ) -> Result<(), Error>

source§

impl<T: Protocol> BitField for Option<T>

source§

fn read( read: &mut dyn BitRead, byte_order: ByteOrder, ctx: &mut dyn Any, bits: u32 ) -> Result<Self, Error>

source§

fn write( &self, write: &mut dyn BitWrite, byte_order: ByteOrder, ctx: &mut dyn Any, bits: u32 ) -> Result<(), Error>

Implementors§