pub struct Bytes<'a> { /* private fields */ }
Expand description

A slice wrapper that implements BytesRead.

Implementations

You should probably use:

let bytes: Bytes = slice.into();
// or
let bytes = Bytes::from(slice);

Returns the inner slice with the original reference.

Trait Implementations

Returns the entire slice.

Returns all remaining bytes.

Try to read a given length of bytes. Read more

Tries to read a given length without updating the internal position. Returns None if there are not enought bytes remaining. Read more

Returns the length of the entire slice.

Reads a given length of bytes. Read more

Try to read 1 bytes in big-endian converting them into an u8. Read more

Reads 1 bytes in big-endian converting them into an u8. Read more

Try to read 2 bytes in big-endian converting them into an u16. Read more

Reads 2 bytes in big-endian converting them into an u16. Read more

Try to read 4 bytes in big-endian converting them into an u32. Read more

Reads 4 bytes in big-endian converting them into an u32. Read more

Try to read 8 bytes in big-endian converting them into an u64. Read more

Reads 8 bytes in big-endian converting them into an u64. Read more

Try to read 16 bytes in big-endian converting them into an u128. Read more

Reads 16 bytes in big-endian converting them into an u128. Read more

Try to read 1 bytes in big-endian converting them into an i8. Read more

Reads 1 bytes in big-endian converting them into an i8. Read more

Try to read 2 bytes in big-endian converting them into an i16. Read more

Reads 2 bytes in big-endian converting them into an i16. Read more

Try to read 4 bytes in big-endian converting them into an i32. Read more

Reads 4 bytes in big-endian converting them into an i32. Read more

Try to read 8 bytes in big-endian converting them into an i64. Read more

Reads 8 bytes in big-endian converting them into an i64. Read more

Try to read 16 bytes in big-endian converting them into an i128. Read more

Reads 16 bytes in big-endian converting them into an i128. Read more

Try to read 4 bytes in big-endian converting them into an f32. Read more

Reads 4 bytes in big-endian converting them into an f32. Read more

Try to read 8 bytes in big-endian converting them into an f64. Read more

Reads 8 bytes in big-endian converting them into an f64. Read more

Try to read 1 bytes in little-endian converting them into an u8. Read more

Reads 1 bytes in little-endian converting them into an u8. Read more

Try to read 2 bytes in little-endian converting them into an u16. Read more

Reads 2 bytes in little-endian converting them into an u16. Read more

Try to read 4 bytes in little-endian converting them into an u32. Read more

Reads 4 bytes in little-endian converting them into an u32. Read more

Try to read 8 bytes in little-endian converting them into an u64. Read more

Reads 8 bytes in little-endian converting them into an u64. Read more

Try to read 16 bytes in little-endian converting them into an u128. Read more

Reads 16 bytes in little-endian converting them into an u128. Read more

Try to read 1 bytes in little-endian converting them into an i8. Read more

Reads 1 bytes in little-endian converting them into an i8. Read more

Try to read 2 bytes in little-endian converting them into an i16. Read more

Reads 2 bytes in little-endian converting them into an i16. Read more

Try to read 4 bytes in little-endian converting them into an i32. Read more

Reads 4 bytes in little-endian converting them into an i32. Read more

Try to read 8 bytes in little-endian converting them into an i64. Read more

Reads 8 bytes in little-endian converting them into an i64. Read more

Try to read 16 bytes in little-endian converting them into an i128. Read more

Reads 16 bytes in little-endian converting them into an i128. Read more

Try to read 4 bytes in little-endian converting them into an f32. Read more

Reads 4 bytes in little-endian converting them into an f32. Read more

Try to read 8 bytes in little-endian converting them into an f64. Read more

Reads 8 bytes in little-endian converting them into an f64. Read more

Returns the entire slice.

Returns all remaining bytes.

Try to read a given length of bytes. Read more

Tries to read a given length without updating the internal position. Returns None if there are not enought bytes remaining. Read more

Reads a given length of bytes. Read more

Returns the internal position.

Sets the internal position.

Fails

If the position exceeds the slice.

Sets the internal position.

Advances the internal position if possible.

Advances the internal position. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

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

🔬 This is a nightly-only experimental API. (can_vector)

Determines if this Reader has an efficient read_vectored implementation. Read more

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

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

Read the exact number of bytes required to fill buf. Read more

🔬 This is a nightly-only experimental API. (read_buf)

Pull some bytes from this source into the specified buffer. Read more

🔬 This is a nightly-only experimental API. (read_buf)

Read the exact number of bytes required to fill buf. Read more

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

Transforms this Read instance to an Iterator over its bytes. Read more

Creates an adapter which will chain this stream with another. Read more

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

Seek to an offset, in bytes, in a stream. Read more

Rewind to the beginning of a stream. Read more

🔬 This is a nightly-only experimental API. (seek_stream_len)

Returns the length of this stream (in bytes). Read more

Returns the current seek position from the start of the stream. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.