Trait Endianness

Source
pub trait Endianness: Sized {
Show 17 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<const MAX: u32, W, U>( writer: &mut W, queue_value: &mut u8, queue_bits: &mut u32, count: BitCount<MAX>, value: U, ) -> Result<()> where W: Write, U: UnsignedInteger; fn write_bits_fixed<const BITS: u32, W, U>( writer: &mut W, queue_value: &mut u8, queue_bits: &mut u32, value: U, ) -> Result<()> where W: Write, U: UnsignedInteger; fn read_signed_counted<const MAX: u32, R, S>( r: &mut R, bits: SignedBitCount<MAX>, ) -> Result<S> where R: BitRead, S: SignedInteger; fn write_signed_counted<const MAX: u32, W, S>( w: &mut W, bits: SignedBitCount<MAX>, value: S, ) -> Result<()> where W: BitWrite, 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; // Provided methods fn read_signed<const MAX: u32, R, S>( r: &mut R, count: BitCount<MAX>, ) -> Result<S> where R: BitRead, S: SignedInteger { ... } fn read_signed_fixed<R, const BITS: u32, S>(r: &mut R) -> Result<S> where R: BitRead, S: SignedInteger { ... } fn write_signed<const MAX: u32, W, S>( w: &mut W, count: BitCount<MAX>, value: S, ) -> Result<()> where W: BitWrite, S: SignedInteger { ... } fn write_signed_fixed<W, const BITS: u32, S>( w: &mut W, value: S, ) -> Result<()> where W: BitWrite, S: SignedInteger { ... }
}
Expand description

A stream’s endianness, or byte order, for determining how bits should be read.

It comes in BigEndian and LittleEndian varieties (which may be shortened to BE and LE) and is not something programmers should have to implement in most cases.

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<const MAX: u32, W, U>( writer: &mut W, queue_value: &mut u8, queue_bits: &mut u32, count: BitCount<MAX>, value: U, ) -> Result<()>
where W: Write, U: UnsignedInteger,

For performing bulk writes of a type to a bit sink.

Source

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

For performing bulk writes of a type 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 write_signed_counted<const MAX: u32, W, S>( w: &mut W, bits: SignedBitCount<MAX>, value: S, ) -> Result<()>
where W: BitWrite, S: SignedInteger,

Writes signed value to writer 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

Provided Methods§

Source

fn read_signed<const MAX: u32, R, S>( r: &mut R, count: BitCount<MAX>, ) -> Result<S>
where R: BitRead, S: SignedInteger,

Reads signed value from reader in this endianness

Source

fn read_signed_fixed<R, const BITS: u32, S>(r: &mut R) -> Result<S>
where R: BitRead, S: SignedInteger,

Reads signed value from reader in this endianness

Source

fn write_signed<const MAX: u32, W, S>( w: &mut W, count: BitCount<MAX>, value: S, ) -> Result<()>
where W: BitWrite, S: SignedInteger,

Writes signed value to writer in this endianness

Source

fn write_signed_fixed<W, const BITS: u32, S>(w: &mut W, value: S) -> Result<()>
where W: BitWrite, S: SignedInteger,

Writes signed 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§