pub trait BitRead: Sized {
// Required method
fn read_bit(&mut self) -> Result<bool>;
// Provided methods
fn read_byte(&mut self) -> Result<u8> { ... }
fn read<T: BitStore>(&mut self) -> Result<T> { ... }
fn read_using<T, C>(&mut self, converter: &C) -> Result<T>
where C: BitConvert<T> { ... }
fn read_to_buffer<T, B>(&mut self, buffer: B) -> usize
where T: BitStore,
B: AsMut<[T]> { ... }
fn read_to_buffer_using<T, B, C>(
&mut self,
buffer: B,
converter: &C,
) -> usize
where B: AsMut<[T]>,
C: BitConvert<T> { ... }
}Expand description
A trait for types that can read bits
Required Methods§
Provided Methods§
Sourcefn read_byte(&mut self) -> Result<u8>
fn read_byte(&mut self) -> Result<u8>
Reads a single byte.
Default implementation is unoptimized and should be overridden
Sourcefn read<T: BitStore>(&mut self) -> Result<T>
fn read<T: BitStore>(&mut self) -> Result<T>
Reads a value that implements BitStore using the read_from function.
Sourcefn read_using<T, C>(&mut self, converter: &C) -> Result<T>where
C: BitConvert<T>,
fn read_using<T, C>(&mut self, converter: &C) -> Result<T>where
C: BitConvert<T>,
Reads a value using a converter that implements BitConvert with the read_value_from function.
Sourcefn read_to_buffer<T, B>(&mut self, buffer: B) -> usize
fn read_to_buffer<T, B>(&mut self, buffer: B) -> usize
Reads values that implement BitStore to a buffer. Returns the number of values read.
Sourcefn read_to_buffer_using<T, B, C>(&mut self, buffer: B, converter: &C) -> usize
fn read_to_buffer_using<T, B, C>(&mut self, buffer: B, converter: &C) -> usize
Reads values using a converter that implements BitConvert to a buffer. Returns the number of values read.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".