pub struct ChiselBigEndian<'a, S: ChiselSource>(/* private fields */);Expand description
A Chisel, with big-endian byte order.
See the crate documentation for more information.
Implementations§
Source§impl<'a, S: ChiselSource> ChiselBigEndian<'a, S>
impl<'a, S: ChiselSource> ChiselBigEndian<'a, S>
Sourcepub fn into_inner(self) -> &'a mut Chisel<S>
pub fn into_inner(self) -> &'a mut Chisel<S>
Consumes the wrapper, returning the input chisel reference.
Sourcepub fn error<E>(&self, err: E, backstep: usize) -> ChiselError<E, S::Error>
pub fn error<E>(&self, err: E, backstep: usize) -> ChiselError<E, S::Error>
Returns a format error that occurred backstep bytes ago.
This is a convenience method for manually determining the appropriate byte offset and calling ChiselError::format.
Sourcepub fn read_buf(&mut self, buf: &mut [u8]) -> InfallibleFormatResult<(), S>
pub fn read_buf(&mut self, buf: &mut [u8]) -> InfallibleFormatResult<(), S>
Fills a provided buffer with bytes from the source.
This operation is endian-independent.
§Errors
This function returns an ChiselErrorData::EndOfInput if the end of the input is encountered
before the buffer is completely filled.
If an error is returned, the contents of buf are unspecified and the chisel breaks.
Sourcepub fn u8(&mut self) -> InfallibleFormatResult<u8, S>
pub fn u8(&mut self) -> InfallibleFormatResult<u8, S>
Reads a single byte u8.
This operation is endian-independent.
Sourcepub fn u16(&mut self) -> InfallibleFormatResult<u16, S>
pub fn u16(&mut self) -> InfallibleFormatResult<u16, S>
Sourcepub fn u32(&mut self) -> InfallibleFormatResult<u32, S>
pub fn u32(&mut self) -> InfallibleFormatResult<u32, S>
Sourcepub fn u64(&mut self) -> InfallibleFormatResult<u64, S>
pub fn u64(&mut self) -> InfallibleFormatResult<u64, S>
Sourcepub fn i8(&mut self) -> InfallibleFormatResult<i8, S>
pub fn i8(&mut self) -> InfallibleFormatResult<i8, S>
Reads a single signed byte i8.
This operation is endian-independent.
Sourcepub fn i16(&mut self) -> InfallibleFormatResult<i16, S>
pub fn i16(&mut self) -> InfallibleFormatResult<i16, S>
Sourcepub fn i32(&mut self) -> InfallibleFormatResult<i32, S>
pub fn i32(&mut self) -> InfallibleFormatResult<i32, S>
Sourcepub fn i64(&mut self) -> InfallibleFormatResult<i64, S>
pub fn i64(&mut self) -> InfallibleFormatResult<i64, S>
Sourcepub fn f32(&mut self) -> InfallibleFormatResult<f32, S>
pub fn f32(&mut self) -> InfallibleFormatResult<f32, S>
Sourcepub fn f64(&mut self) -> InfallibleFormatResult<f64, S>
pub fn f64(&mut self) -> InfallibleFormatResult<f64, S>
Sourcepub fn skip(&mut self, how_many: usize) -> InfallibleFormatResult<(), S>
pub fn skip(&mut self, how_many: usize) -> InfallibleFormatResult<(), S>
Skips how_many bytes of the underlying source.
This operation is endian-independent.
This is provided for optimization reasons. This hint is forwarded to the source.
Exactly how_many bytes are skipped, as-if read_buf were called with a buffer
of appropriate size, with the buffer being discarded.
§Errors
If an end-of-input condition occurs before how_many bytes are skipped, an ChiselErrorData::EndOfInput error is returned.
If an error is returned, the chisel breaks.
Sourcepub fn read_until(
&mut self,
byte: u8,
dest: &mut Vec<u8>,
) -> InfallibleFormatResult<(), S>
pub fn read_until( &mut self, byte: u8, dest: &mut Vec<u8>, ) -> InfallibleFormatResult<(), S>
Reads bytes into the provided dest Vec until the delimiter byte is encountered.
This operation is endian-independent.
§Errors
If the end of the input is encountered before the delimiter is found, ChiselErrorData::EndOfInput is returned.
If an error is returned, the chisel breaks.