Skip to main content

Endianness

Trait Endianness 

Source
pub trait Endianness: Sized {
Show 14 methods // Required methods fn pop_bit_refill<R>( reader: &mut R, queue_value: &mut u8, queue_bits: &mut u32, ) -> Result<bool> where R: Read; fn pop_unary<const STOP_BIT: u8, R>( reader: &mut R, queue_value: &mut u8, queue_bits: &mut u32, ) -> Result<u32> where R: Read; fn push_bit_flush( queue_value: &mut u8, queue_bits: &mut u32, bit: bool, ) -> Option<u8>; fn read_bits<const MAX: u32, R, U>( reader: &mut R, queue_value: &mut u8, queue_bits: &mut u32, count: BitCount<MAX>, ) -> Result<U> where R: Read, U: UnsignedInteger; fn read_bits_fixed<const BITS: u32, R, U>( reader: &mut R, queue_value: &mut u8, queue_bits: &mut u32, ) -> Result<U> where R: Read, U: UnsignedInteger; fn write_bits_checked<const MAX: u32, W, U>( writer: &mut W, queue_value: &mut u8, queue_bits: &mut u32, value: CheckedUnsigned<MAX, U>, ) -> Result<()> where W: Write, U: UnsignedInteger; fn write_signed_bits_checked<const MAX: u32, W, S>( writer: &mut W, queue_value: &mut u8, queue_bits: &mut u32, value: CheckedSigned<MAX, S>, ) -> Result<()> where W: Write, S: SignedInteger; fn read_signed_counted<const MAX: u32, R, S>( r: &mut R, bits: SignedBitCount<MAX>, ) -> Result<S> where R: BitRead, S: SignedInteger; fn read_bytes<const CHUNK_SIZE: usize, R>( reader: &mut R, queue_value: &mut u8, queue_bits: u32, buf: &mut [u8], ) -> Result<()> where R: Read; fn write_bytes<const CHUNK_SIZE: usize, W>( writer: &mut W, queue_value: &mut u8, queue_bits: u32, buf: &[u8], ) -> Result<()> where W: Write; fn bytes_to_primitive<P: Primitive>(buf: P::Bytes) -> P; fn primitive_to_bytes<P: Primitive>(p: P) -> P::Bytes; fn read_primitive<R, V>(r: &mut R) -> Result<V> where R: BitRead, V: Primitive; fn write_primitive<W, V>(w: &mut W, value: V) -> Result<()> where W: BitWrite, V: Primitive;
}

Required Methods§

Source

fn pop_bit_refill<R>( reader: &mut R, queue_value: &mut u8, queue_bits: &mut u32, ) -> Result<bool>
where R: Read,

Pops the next bit from the queue, repleneshing it from the given reader if necessary

Source

fn pop_unary<const STOP_BIT: u8, R>( reader: &mut R, queue_value: &mut u8, queue_bits: &mut u32, ) -> Result<u32>
where R: Read,

Pops the next unary value from the source until STOP_BIT is encountered, replenishing it from the given closure if necessary.

STOP_BIT must be 0 or 1.

Source

fn push_bit_flush( queue_value: &mut u8, queue_bits: &mut u32, bit: bool, ) -> Option<u8>

Pushes the next bit into the queue, and returns Some value if the queue is full.

Source

fn read_bits<const MAX: u32, R, U>( reader: &mut R, queue_value: &mut u8, queue_bits: &mut u32, count: BitCount<MAX>, ) -> Result<U>
where R: Read, U: UnsignedInteger,

For performing bulk reads from a bit source to an output type.

Source

fn read_bits_fixed<const BITS: u32, R, U>( reader: &mut R, queue_value: &mut u8, queue_bits: &mut u32, ) -> Result<U>
where R: Read, U: UnsignedInteger,

For performing bulk reads from a bit source to an output type.

Source

fn write_bits_checked<const MAX: u32, W, U>( writer: &mut W, queue_value: &mut u8, queue_bits: &mut u32, value: CheckedUnsigned<MAX, U>, ) -> Result<()>
where W: Write, U: UnsignedInteger,

For performing a checked write to a bit sink

Source

fn write_signed_bits_checked<const MAX: u32, W, S>( writer: &mut W, queue_value: &mut u8, queue_bits: &mut u32, value: CheckedSigned<MAX, S>, ) -> Result<()>
where W: Write, S: SignedInteger,

For performing a checked signed write to a bit sink

Source

fn read_signed_counted<const MAX: u32, R, S>( r: &mut R, bits: SignedBitCount<MAX>, ) -> Result<S>
where R: BitRead, S: SignedInteger,

Reads signed value from reader in this endianness

Source

fn read_bytes<const CHUNK_SIZE: usize, R>( reader: &mut R, queue_value: &mut u8, queue_bits: u32, buf: &mut [u8], ) -> Result<()>
where R: Read,

Reads whole set of bytes to output buffer

Source

fn write_bytes<const CHUNK_SIZE: usize, W>( writer: &mut W, queue_value: &mut u8, queue_bits: u32, buf: &[u8], ) -> Result<()>
where W: Write,

Writes whole set of bytes to output buffer

Source

fn bytes_to_primitive<P: Primitive>(buf: P::Bytes) -> P

Converts a primitive’s byte buffer to a primitive

Source

fn primitive_to_bytes<P: Primitive>(p: P) -> P::Bytes

Converts a primitive to a primitive’s byte buffer

Source

fn read_primitive<R, V>(r: &mut R) -> Result<V>
where R: BitRead, V: Primitive,

👎Deprecated since 4.0.0

Reads convertable numeric value from reader in this endianness

Source

fn write_primitive<W, V>(w: &mut W, value: V) -> Result<()>
where W: BitWrite, V: Primitive,

👎Deprecated since 4.0.0

Writes convertable numeric value to writer in this endianness

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§