Struct ByteOrdered

Source
pub struct ByteOrdered<T, E> { /* private fields */ }
Expand description

Wrapper type for a reader or writer with an assumed byte order.

More details can be found at the crate level documentation.

Implementations§

Source§

impl<T> ByteOrdered<T, StaticEndianness<LittleEndian>>

Source

pub fn le(inner: T) -> Self

Obtains a new reader or writer that assumes data in little endian.

Source§

impl<T> ByteOrdered<T, StaticEndianness<BigEndian>>

Source

pub fn be(inner: T) -> Self

Obtains a new reader or writer that assumes data in big endian.

Source§

impl<T> ByteOrdered<T, StaticEndianness<NativeEndian>>

Source

pub fn native(inner: T) -> Self

Obtains a new reader or writer that assumes data in the system’s native endianness. While this method might sounds a bit pointless, it enables easier byte order changes through method chaining).

Source§

impl<T> ByteOrdered<T, StaticEndianness<NetworkEndian>>

Source

pub fn network(inner: T) -> Self

Obtains a new reader or writer that assumes network order.

Source§

impl<T> ByteOrdered<T, Endianness>

Source

pub fn runtime(inner: T, endianness: Endianness) -> Self

Creates a new reader or writer that assumes data in the given byte order known at run-time. That is, the type representing the byte order is the enum type Endianness.

Although it is equivalent to ByteOrdered::new, this function leaves a code signal that subsequent calls depend on conditions resolved at run-time. If you know the data’s endianness in compile time, the other constructors are preferred (e.g. new, le or be), so as to avoid the overhead of dynamic dispatching.

Source§

impl<T, E> ByteOrdered<T, E>
where E: Endian,

Source

pub fn new(inner: T, endianness: E) -> Self

Creates a new reader or writer that assumes data in the given byte order. This flexible constructor admits any kind of byte order (static and dynamic).

Note: The other constructors (le, be, native, and runtime) are more recommended because they are easier to use and leave a better signal of whether the endianness is known at compile time or at run time. For example, if you pass a value literal of type Endianness (such as Endianness::Little), the program will perform dynamic dispatching in spite of the fixed byte order. The use of this method is more appropriate when constructing functions which are generic over the endianness type.

Source

pub fn into_inner(self) -> T

Recovers the inner reader or writer from this wrapper. Information about the assumed byte order is discarded.

Source

pub fn inner_mut(&mut self) -> &mut T

Obtains an exclusive mutable reference to the inner reader or writer in this wrapper. Information about the assumed byte order is ignored until the reference is dropped.

Source

pub fn as_mut(&mut self) -> ByteOrdered<&mut T, E>
where E: Copy,

Converts from ByteOrdered<T, E> to ByteOrdered<&mut T, E>, copying the endianness information.

Source

pub fn into_parts(self) -> (T, E)

Disbands a ByteOrder into its parts.

Source

pub fn map<F, U>(self, f: F) -> ByteOrdered<U, E>
where F: FnOnce(T) -> U,

Maps a ByteOrdered<T, E> into a ByteOrdered<O, E> by applying the given function to the inner reader or writer.

Source

pub fn into_endianness<E2: Endian>(self, endianness: E2) -> ByteOrdered<T, E2>

Changes the assumed byte order of the reader or writer.

Source

pub fn set_endianness(&mut self, endianness: E)

Modifies the assumed byte order of the reader or writer inline with the value. Since the endianness type needs to be the same, this function is only relevant when E is a run-time defined byte order (see Endianness).

Source

pub fn into_le(self) -> ByteOrdered<T, StaticEndianness<LittleEndian>>

Changes the assumed byte order of the reader or writer to little endian.

Source

pub fn into_be(self) -> ByteOrdered<T, StaticEndianness<BigEndian>>

Changes the assumed byte order of the reader or writer to little endian.

Source

pub fn into_native(self) -> ByteOrdered<T, StaticEndianness<NativeEndian>>

Changes the assumed byte order of the reader or writer to the system’s native endianness.

Source

pub fn into_opposite(self) -> ByteOrdered<T, E::Opposite>
where E: Endian,

Converts the assumed endianness to the opposite of the current order.

Source

pub fn endianness(&self) -> E
where E: Copy,

Retrieves the byte order assumed by this wrapper.

Source

pub fn is_native(&self) -> bool
where E: Endian,

Checks whether the assumed endianness is the system’s native byte order.

Source§

impl<R, E> ByteOrdered<R, E>
where R: ReadBytesExt, E: Endian,

Source

pub fn read_i8(&mut self) -> IoResult<i8>

Reads a signed 8 bit integer from the underlying reader.

This method does exactly the same thing as read_i8 in byteorder::ReadBytesExt. It is included so that users do not have to import the former trait.

§Errors

This method returns the same errors as Read::read_exact.

§Examples

Read unsigned 8 bit integers from a Read:

use byteordered::ByteOrdered;

let mut rdr = ByteOrdered::native(&[2, 5][..]);
assert_eq!(2, rdr.read_i8()?);
assert_eq!(5, rdr.read_i8()?);
Source

pub fn read_u8(&mut self) -> IoResult<u8>

Reads an unsigned 8 bit integer from the underlying reader.

This method does exactly the same thing as read_u8 in byteorder::ReadBytesExt. It is included so that users do not have to import the former trait.

§Errors

This method returns the same errors as Read::read_exact.

§Examples

Read unsigned 8 bit integers from a Read:

use byteordered::ByteOrdered;

let mut rdr = ByteOrdered::native(&[2, 5][..]);
assert_eq!(2, rdr.read_u8()?);
assert_eq!(5, rdr.read_u8()?);
Source

pub fn read_i16(&mut self) -> IoResult<i16>

Reads a signed 16 bit integer from the underlying reader.

§Errors

This method returns the same errors as Read::read_exact.

§Examples

Read signed 16 bit big-endian integers from a Read:

use byteordered::ByteOrdered;

let mut rdr = ByteOrdered::be(&[0x00, 0xc1, 0xff, 0x7c][..]);
assert_eq!(193, rdr.read_i16()?);
assert_eq!(-132, rdr.read_i16()?);
Source

pub fn read_i16_into(&mut self, dst: &mut [i16]) -> IoResult<()>

Reads a sequence of signed 16 bit integers from the underlying reader.

The given buffer is either filled completely or an error is returned. If an error is returned, the contents of dst are unspecified.

§Errors

This method returns the same errors as Read::read_exact.

§Examples

Read two signed 16 bit big-endian integers from a Read:

let mut out = [0; 2];
let mut rdr = ByteOrdered::be(&[0x00, 0xc1, 0xff, 0x7c][..]);
rdr.read_i16_into(&mut out)?;
assert_eq!(out, [193, -132]);
Source

pub fn read_u16(&mut self) -> IoResult<u16>

Reads an unsigned 16 bit integer from the underlying reader.

§Errors

This method returns the same errors as Read::read_exact.

Source

pub fn read_u16_into(&mut self, dst: &mut [u16]) -> IoResult<()>

Reads a sequence of unsigned 16 bit integers from the underlying reader.

The given buffer is either filled completely or an error is returned. If an error is returned, the contents of dst are unspecified.

§Errors

This method returns the same errors as Read::read_exact.

Source

pub fn read_i32(&mut self) -> IoResult<i32>

Reads a signed 32 bit integer from the underlying reader.

§Errors

This method returns the same errors as Read::read_exact.

Source

pub fn read_i32_into(&mut self, dst: &mut [i32]) -> IoResult<()>

Reads a sequence of signed 32 bit integers from the underlying reader.

The given buffer is either filled completely or an error is returned. If an error is returned, the contents of dst are unspecified.

§Errors

This method returns the same errors as Read::read_exact.

Source

pub fn read_u32(&mut self) -> IoResult<u32>

Reads an unsigned 32 bit integer from the underlying reader.

§Errors

This method returns the same errors as Read::read_exact.

Source

pub fn read_u32_into(&mut self, dst: &mut [u32]) -> IoResult<()>

Reads a sequence of unsigned 32 bit integers from the underlying reader.

The given buffer is either filled completely or an error is returned. If an error is returned, the contents of dst are unspecified.

§Errors

This method returns the same errors as Read::read_exact.

Source

pub fn read_i64(&mut self) -> IoResult<i64>

Reads a signed 64 bit integer from the underlying reader.

§Errors

This method returns the same errors as Read::read_exact.

Source

pub fn read_i64_into(&mut self, dst: &mut [i64]) -> IoResult<()>

Reads a sequence of signed 64 bit integers from the underlying reader.

The given buffer is either filled completely or an error is returned. If an error is returned, the contents of dst are unspecified.

§Errors

This method returns the same errors as Read::read_exact.

Source

pub fn read_u64(&mut self) -> IoResult<u64>

Reads an unsigned 16 bit integer from the underlying reader.

§Errors

This method returns the same errors as Read::read_exact.

Source

pub fn read_u64_into(&mut self, dst: &mut [u64]) -> IoResult<()>

Reads a sequence of unsigned 64 bit integers from the underlying reader.

The given buffer is either filled completely or an error is returned. If an error is returned, the contents of dst are unspecified.

§Errors

This method returns the same errors as Read::read_exact.

Source

pub fn read_i128(&mut self) -> IoResult<i128>

Reads a signed 128 bit integer from the underlying reader.

§Errors

This method returns the same errors as Read::read_exact.

Source

pub fn read_i128_into(&mut self, dst: &mut [i128]) -> IoResult<()>

Reads a sequence of signed 128 bit integers from the underlying reader.

The given buffer is either filled completely or an error is returned. If an error is returned, the contents of dst are unspecified.

§Errors

This method returns the same errors as Read::read_exact.

Source

pub fn read_u128(&mut self) -> IoResult<u128>

Reads an unsigned 16 bit integer from the underlying reader.

§Errors

This method returns the same errors as Read::read_exact.

Source

pub fn read_u128_into(&mut self, dst: &mut [u128]) -> IoResult<()>

Reads a sequence of unsigned 128 bit integers from the underlying reader.

The given buffer is either filled completely or an error is returned. If an error is returned, the contents of dst are unspecified.

§Errors

This method returns the same errors as Read::read_exact.

Source

pub fn read_f32(&mut self) -> IoResult<f32>

Reads a IEEE754 single-precision (4 bytes) floating point number from the underlying reader.

§Errors

This method returns the same errors as Read::read_exact.

Source

pub fn read_f32_into(&mut self, dst: &mut [f32]) -> IoResult<()>

Reads a sequence of IEEE754 single-precision (4 bytes) floating point numbers from the underlying reader.

The given buffer is either filled completely or an error is returned. If an error is returned, the contents of dst are unspecified.

§Errors

This method returns the same errors as Read::read_exact.

Source

pub fn read_f64(&mut self) -> IoResult<f64>

Reads a IEEE754 double-precision (8 bytes) floating point number from the underlying reader.

§Errors

This method returns the same errors as Read::read_exact.

Source

pub fn read_f64_into(&mut self, dst: &mut [f64]) -> IoResult<()>

Reads a sequence of IEEE754 double-precision (8 bytes) floating point numbers from the underlying reader.

The given buffer is either filled completely or an error is returned. If an error is returned, the contents of dst are unspecified.

§Errors

This method returns the same errors as Read::read_exact.

Source§

impl<W, E> ByteOrdered<W, E>
where W: WriteBytesExt, E: Endian,

Source

pub fn write_i8(&mut self, x: i8) -> IoResult<()>

Writes a signed 8 bit integer to the underlying writer.

Note that since this writes a single byte, no byte order conversions are used. It is included for completeness.

§Errors

This method returns the same errors as Write::write_all.

Source

pub fn write_u8(&mut self, x: u8) -> IoResult<()>

Writes an unsigned 8 bit integer to the underlying writer.

Note that since this writes a single byte, no byte order conversions are used. It is included for completeness.

§Errors

This method returns the same errors as Write::write_all.

Source

pub fn write_i16(&mut self, x: i16) -> IoResult<()>

Writes a signed 16 bit integer to the underlying writer.

§Errors

This method returns the same errors as Write::write_all.

§Examples

Write signed 16 bit big-endian integers to a Write:

use byteordered::ByteOrdered;

let mut wtr = ByteOrdered::be(Vec::new());
wtr.write_i16(193).unwrap();
wtr.write_i16(-132).unwrap();
assert_eq!(wtr.into_inner(), b"\x00\xc1\xff\x7c");
Source

pub fn write_u16(&mut self, x: u16) -> IoResult<()>

Writes an unsigned 16 bit integer to the underlying writer.

§Errors

This method returns the same errors as Write::write_all.

Source

pub fn write_i32(&mut self, x: i32) -> IoResult<()>

Writes a signed 32 bit integer to the underlying writer.

§Errors

This method returns the same errors as Write::write_all.

Source

pub fn write_u32(&mut self, x: u32) -> IoResult<()>

Writes an unsigned 32 bit integer to the underlying writer.

§Errors

This method returns the same errors as Write::write_all.

Source

pub fn write_i64(&mut self, x: i64) -> IoResult<()>

Writes a signed 64 bit integer to the underlying writer.

§Errors

This method returns the same errors as Write::write_all.

Source

pub fn write_u64(&mut self, x: u64) -> IoResult<()>

Writes an unsigned 64 bit integer to the underlying writer.

§Errors

This method returns the same errors as Write::write_all.

Source

pub fn write_i128(&mut self, x: i128) -> IoResult<()>

Writes a signed 128 bit integer to the underlying writer.

§Errors

This method returns the same errors as Write::write_all.

Source

pub fn write_u128(&mut self, x: u128) -> IoResult<()>

Writes an unsigned 128 bit integer to the underlying writer.

§Errors

This method returns the same errors as Write::write_all.

Source

pub fn write_f32(&mut self, x: f32) -> IoResult<()>

Writes a IEEE754 single-precision (4 bytes) floating point number to the underlying writer.

§Errors

This method returns the same errors as Write::write_all.

Source

pub fn write_f64(&mut self, x: f64) -> IoResult<()>

Writes a IEEE754 double-precision (8 bytes) floating point number to the underlying writer.

§Errors

This method returns the same errors as Write::write_all.

Trait Implementations§

Source§

impl<T, E> BufRead for ByteOrdered<T, E>
where T: BufRead,

Source§

fn fill_buf(&mut self) -> IoResult<&[u8]>

Returns the contents of the internal buffer, filling it with more data, via Read methods, if empty. Read more
Source§

fn consume(&mut self, amt: usize)

Marks the given amount of additional bytes from the internal buffer as having been read. Subsequent calls to read only return bytes that have not been marked as read. Read more
Source§

fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> IoResult<usize>

Reads all bytes into buf until the delimiter byte or EOF is reached. Read more
Source§

fn read_line(&mut self, buf: &mut String) -> IoResult<usize>

Reads all bytes until a newline (the 0xA byte) is reached, and append them to the provided String buffer. Read more
Source§

fn has_data_left(&mut self) -> Result<bool, Error>

🔬This is a nightly-only experimental API. (buf_read_has_data_left)
Checks if there is any data left to be read. Read more
1.83.0 · Source§

fn skip_until(&mut self, byte: u8) -> Result<usize, Error>

Skips all bytes until the delimiter byte or EOF is reached. Read more
1.0.0 · Source§

fn split(self, byte: u8) -> Split<Self>
where Self: Sized,

Returns an iterator over the contents of this reader split on the byte byte. Read more
1.0.0 · Source§

fn lines(self) -> Lines<Self>
where Self: Sized,

Returns an iterator over the lines of this reader. Read more
Source§

impl<T: Clone, E: Clone> Clone for ByteOrdered<T, E>

Source§

fn clone(&self) -> ByteOrdered<T, E>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug, E: Debug> Debug for ByteOrdered<T, E>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T, E> From<(T, E)> for ByteOrdered<T, E>

Source§

fn from((inner, endianness): (T, E)) -> Self

Converts to this type from the input type.
Source§

impl<R, E> Read for ByteOrdered<R, E>
where R: Read,

Source§

fn read(&mut self, buf: &mut [u8]) -> IoResult<usize>

Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more
Source§

fn read_to_end(&mut self, buf: &mut Vec<u8>) -> IoResult<usize>

Reads all bytes until EOF in this source, placing them into buf. Read more
Source§

fn read_to_string(&mut self, buf: &mut String) -> IoResult<usize>

Reads all bytes until EOF in this source, appending them to buf. Read more
Source§

fn read_exact(&mut self, buf: &mut [u8]) -> IoResult<()>

Reads the exact number of bytes required to fill buf. Read more
1.36.0 · Source§

fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>

Like read, except that it reads into a slice of buffers. Read more
Source§

fn is_read_vectored(&self) -> bool

🔬This is a nightly-only experimental API. (can_vector)
Determines if this Reader has an efficient read_vectored implementation. Read more
Source§

fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>

🔬This is a nightly-only experimental API. (read_buf)
Pull some bytes from this source into the specified buffer. Read more
Source§

fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>

🔬This is a nightly-only experimental API. (read_buf)
Reads the exact number of bytes required to fill cursor. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where Self: Sized,

Creates a “by reference” adaptor for this instance of Read. Read more
1.0.0 · Source§

fn bytes(self) -> Bytes<Self>
where Self: Sized,

Transforms this Read instance to an Iterator over its bytes. Read more
1.0.0 · Source§

fn chain<R>(self, next: R) -> Chain<Self, R>
where R: Read, Self: Sized,

Creates an adapter which will chain this stream with another. Read more
1.0.0 · Source§

fn take(self, limit: u64) -> Take<Self>
where Self: Sized,

Creates an adapter which will read at most limit bytes from it. Read more
Source§

impl<T, E> Seek for ByteOrdered<T, E>
where T: Seek,

Source§

fn seek(&mut self, pos: SeekFrom) -> IoResult<u64>

Seek to an offset, in bytes, in a stream. Read more
1.55.0 · Source§

fn rewind(&mut self) -> Result<(), Error>

Rewind to the beginning of a stream. Read more
Source§

fn stream_len(&mut self) -> Result<u64, Error>

🔬This is a nightly-only experimental API. (seek_stream_len)
Returns the length of this stream (in bytes). Read more
1.51.0 · Source§

fn stream_position(&mut self) -> Result<u64, Error>

Returns the current seek position from the start of the stream. Read more
1.80.0 · Source§

fn seek_relative(&mut self, offset: i64) -> Result<(), Error>

Seeks relative to the current position. Read more
Source§

impl<W, E> Write for ByteOrdered<W, E>
where W: Write,

Source§

fn write(&mut self, buf: &[u8]) -> IoResult<usize>

Writes a buffer into this writer, returning how many bytes were written. Read more
Source§

fn flush(&mut self) -> IoResult<()>

Flushes this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
Source§

fn write_all(&mut self, buf: &[u8]) -> IoResult<()>

Attempts to write an entire buffer into this writer. Read more
Source§

fn write_fmt(&mut self, fmt: Arguments<'_>) -> IoResult<()>

Writes a formatted string into this writer, returning any error encountered. Read more
1.36.0 · Source§

fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize, Error>

Like write, except that it writes from a slice of buffers. Read more
Source§

fn is_write_vectored(&self) -> bool

🔬This is a nightly-only experimental API. (can_vector)
Determines if this Writer has an efficient write_vectored implementation. Read more
Source§

fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>

🔬This is a nightly-only experimental API. (write_all_vectored)
Attempts to write multiple buffers into this writer. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where Self: Sized,

Creates a “by reference” adapter for this instance of Write. Read more

Auto Trait Implementations§

§

impl<T, E> Freeze for ByteOrdered<T, E>
where T: Freeze, E: Freeze,

§

impl<T, E> RefUnwindSafe for ByteOrdered<T, E>

§

impl<T, E> Send for ByteOrdered<T, E>
where T: Send, E: Send,

§

impl<T, E> Sync for ByteOrdered<T, E>
where T: Sync, E: Sync,

§

impl<T, E> Unpin for ByteOrdered<T, E>
where T: Unpin, E: Unpin,

§

impl<T, E> UnwindSafe for ByteOrdered<T, E>
where T: UnwindSafe, E: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<R> ReadBytesExt for R
where R: Read + ?Sized,

Source§

fn read_u8(&mut self) -> Result<u8, Error>

Reads an unsigned 8 bit integer from the underlying reader. Read more
Source§

fn read_i8(&mut self) -> Result<i8, Error>

Reads a signed 8 bit integer from the underlying reader. Read more
Source§

fn read_u16<T>(&mut self) -> Result<u16, Error>
where T: ByteOrder,

Reads an unsigned 16 bit integer from the underlying reader. Read more
Source§

fn read_i16<T>(&mut self) -> Result<i16, Error>
where T: ByteOrder,

Reads a signed 16 bit integer from the underlying reader. Read more
Source§

fn read_u24<T>(&mut self) -> Result<u32, Error>
where T: ByteOrder,

Reads an unsigned 24 bit integer from the underlying reader. Read more
Source§

fn read_i24<T>(&mut self) -> Result<i32, Error>
where T: ByteOrder,

Reads a signed 24 bit integer from the underlying reader. Read more
Source§

fn read_u32<T>(&mut self) -> Result<u32, Error>
where T: ByteOrder,

Reads an unsigned 32 bit integer from the underlying reader. Read more
Source§

fn read_i32<T>(&mut self) -> Result<i32, Error>
where T: ByteOrder,

Reads a signed 32 bit integer from the underlying reader. Read more
Source§

fn read_u48<T>(&mut self) -> Result<u64, Error>
where T: ByteOrder,

Reads an unsigned 48 bit integer from the underlying reader. Read more
Source§

fn read_i48<T>(&mut self) -> Result<i64, Error>
where T: ByteOrder,

Reads a signed 48 bit integer from the underlying reader. Read more
Source§

fn read_u64<T>(&mut self) -> Result<u64, Error>
where T: ByteOrder,

Reads an unsigned 64 bit integer from the underlying reader. Read more
Source§

fn read_i64<T>(&mut self) -> Result<i64, Error>
where T: ByteOrder,

Reads a signed 64 bit integer from the underlying reader. Read more
Source§

fn read_u128<T>(&mut self) -> Result<u128, Error>
where T: ByteOrder,

Reads an unsigned 128 bit integer from the underlying reader. Read more
Source§

fn read_i128<T>(&mut self) -> Result<i128, Error>
where T: ByteOrder,

Reads a signed 128 bit integer from the underlying reader. Read more
Source§

fn read_uint<T>(&mut self, nbytes: usize) -> Result<u64, Error>
where T: ByteOrder,

Reads an unsigned n-bytes integer from the underlying reader. Read more
Source§

fn read_int<T>(&mut self, nbytes: usize) -> Result<i64, Error>
where T: ByteOrder,

Reads a signed n-bytes integer from the underlying reader. Read more
Source§

fn read_uint128<T>(&mut self, nbytes: usize) -> Result<u128, Error>
where T: ByteOrder,

Reads an unsigned n-bytes integer from the underlying reader.
Source§

fn read_int128<T>(&mut self, nbytes: usize) -> Result<i128, Error>
where T: ByteOrder,

Reads a signed n-bytes integer from the underlying reader.
Source§

fn read_f32<T>(&mut self) -> Result<f32, Error>
where T: ByteOrder,

Reads a IEEE754 single-precision (4 bytes) floating point number from the underlying reader. Read more
Source§

fn read_f64<T>(&mut self) -> Result<f64, Error>
where T: ByteOrder,

Reads a IEEE754 double-precision (8 bytes) floating point number from the underlying reader. Read more
Source§

fn read_u16_into<T>(&mut self, dst: &mut [u16]) -> Result<(), Error>
where T: ByteOrder,

Reads a sequence of unsigned 16 bit integers from the underlying reader. Read more
Source§

fn read_u32_into<T>(&mut self, dst: &mut [u32]) -> Result<(), Error>
where T: ByteOrder,

Reads a sequence of unsigned 32 bit integers from the underlying reader. Read more
Source§

fn read_u64_into<T>(&mut self, dst: &mut [u64]) -> Result<(), Error>
where T: ByteOrder,

Reads a sequence of unsigned 64 bit integers from the underlying reader. Read more
Source§

fn read_u128_into<T>(&mut self, dst: &mut [u128]) -> Result<(), Error>
where T: ByteOrder,

Reads a sequence of unsigned 128 bit integers from the underlying reader. Read more
Source§

fn read_i8_into(&mut self, dst: &mut [i8]) -> Result<(), Error>

Reads a sequence of signed 8 bit integers from the underlying reader. Read more
Source§

fn read_i16_into<T>(&mut self, dst: &mut [i16]) -> Result<(), Error>
where T: ByteOrder,

Reads a sequence of signed 16 bit integers from the underlying reader. Read more
Source§

fn read_i32_into<T>(&mut self, dst: &mut [i32]) -> Result<(), Error>
where T: ByteOrder,

Reads a sequence of signed 32 bit integers from the underlying reader. Read more
Source§

fn read_i64_into<T>(&mut self, dst: &mut [i64]) -> Result<(), Error>
where T: ByteOrder,

Reads a sequence of signed 64 bit integers from the underlying reader. Read more
Source§

fn read_i128_into<T>(&mut self, dst: &mut [i128]) -> Result<(), Error>
where T: ByteOrder,

Reads a sequence of signed 128 bit integers from the underlying reader. Read more
Source§

fn read_f32_into<T>(&mut self, dst: &mut [f32]) -> Result<(), Error>
where T: ByteOrder,

Reads a sequence of IEEE754 single-precision (4 bytes) floating point numbers from the underlying reader. Read more
Source§

fn read_f32_into_unchecked<T>(&mut self, dst: &mut [f32]) -> Result<(), Error>
where T: ByteOrder,

👎Deprecated since 1.2.0: please use read_f32_into instead
DEPRECATED. Read more
Source§

fn read_f64_into<T>(&mut self, dst: &mut [f64]) -> Result<(), Error>
where T: ByteOrder,

Reads a sequence of IEEE754 double-precision (8 bytes) floating point numbers from the underlying reader. Read more
Source§

fn read_f64_into_unchecked<T>(&mut self, dst: &mut [f64]) -> Result<(), Error>
where T: ByteOrder,

👎Deprecated since 1.2.0: please use read_f64_into instead
DEPRECATED. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<W> WriteBytesExt for W
where W: Write + ?Sized,

Source§

fn write_u8(&mut self, n: u8) -> Result<(), Error>

Writes an unsigned 8 bit integer to the underlying writer. Read more
Source§

fn write_i8(&mut self, n: i8) -> Result<(), Error>

Writes a signed 8 bit integer to the underlying writer. Read more
Source§

fn write_u16<T>(&mut self, n: u16) -> Result<(), Error>
where T: ByteOrder,

Writes an unsigned 16 bit integer to the underlying writer. Read more
Source§

fn write_i16<T>(&mut self, n: i16) -> Result<(), Error>
where T: ByteOrder,

Writes a signed 16 bit integer to the underlying writer. Read more
Source§

fn write_u24<T>(&mut self, n: u32) -> Result<(), Error>
where T: ByteOrder,

Writes an unsigned 24 bit integer to the underlying writer. Read more
Source§

fn write_i24<T>(&mut self, n: i32) -> Result<(), Error>
where T: ByteOrder,

Writes a signed 24 bit integer to the underlying writer. Read more
Source§

fn write_u32<T>(&mut self, n: u32) -> Result<(), Error>
where T: ByteOrder,

Writes an unsigned 32 bit integer to the underlying writer. Read more
Source§

fn write_i32<T>(&mut self, n: i32) -> Result<(), Error>
where T: ByteOrder,

Writes a signed 32 bit integer to the underlying writer. Read more
Source§

fn write_u48<T>(&mut self, n: u64) -> Result<(), Error>
where T: ByteOrder,

Writes an unsigned 48 bit integer to the underlying writer. Read more
Source§

fn write_i48<T>(&mut self, n: i64) -> Result<(), Error>
where T: ByteOrder,

Writes a signed 48 bit integer to the underlying writer. Read more
Source§

fn write_u64<T>(&mut self, n: u64) -> Result<(), Error>
where T: ByteOrder,

Writes an unsigned 64 bit integer to the underlying writer. Read more
Source§

fn write_i64<T>(&mut self, n: i64) -> Result<(), Error>
where T: ByteOrder,

Writes a signed 64 bit integer to the underlying writer. Read more
Source§

fn write_u128<T>(&mut self, n: u128) -> Result<(), Error>
where T: ByteOrder,

Writes an unsigned 128 bit integer to the underlying writer.
Source§

fn write_i128<T>(&mut self, n: i128) -> Result<(), Error>
where T: ByteOrder,

Writes a signed 128 bit integer to the underlying writer.
Source§

fn write_uint<T>(&mut self, n: u64, nbytes: usize) -> Result<(), Error>
where T: ByteOrder,

Writes an unsigned n-bytes integer to the underlying writer. Read more
Source§

fn write_int<T>(&mut self, n: i64, nbytes: usize) -> Result<(), Error>
where T: ByteOrder,

Writes a signed n-bytes integer to the underlying writer. Read more
Source§

fn write_uint128<T>(&mut self, n: u128, nbytes: usize) -> Result<(), Error>
where T: ByteOrder,

Writes an unsigned n-bytes integer to the underlying writer. Read more
Source§

fn write_int128<T>(&mut self, n: i128, nbytes: usize) -> Result<(), Error>
where T: ByteOrder,

Writes a signed n-bytes integer to the underlying writer. Read more
Source§

fn write_f32<T>(&mut self, n: f32) -> Result<(), Error>
where T: ByteOrder,

Writes a IEEE754 single-precision (4 bytes) floating point number to the underlying writer. Read more
Source§

fn write_f64<T>(&mut self, n: f64) -> Result<(), Error>
where T: ByteOrder,

Writes a IEEE754 double-precision (8 bytes) floating point number to the underlying writer. Read more