Struct bytecursor::bytecursor::ByteCursor[][src]

pub struct ByteCursor { /* fields omitted */ }

Implementations

Creates a new Bytecursor from the inner bytes it will contains. Sets the position to 0 initially.

Consumes the Bytecursor, returning the inner bytes.

Returns an immutable reference to the inner bytes of the Bytecursor

Returns a mutable reference to the inner bytes of the Bytecursor

Returns the current position of the Bytecursor

Sets the position of the Bytecursor to pos

Reads buf.len() bytes into buf from read, advancing the Bytecursor’s position. It returns the number of bytes actually read.

Reads exactly buf.len() bytes into buf, throwing an error if that number of bytes was not able to be read.

Errors

Will return Err if the buffer is longer than the available bytes to read

Returns a byte slice containing all remaining bytes in the inner bytes after the current position of the Bytecursor.

Seeks to the position referenced by style, returning the new position of the Bytecursor and throwing an error if the new position would be invalid. # Errors

Will return Err if one tries to seek to a negative or overflowing position

Writes buf.len() bytes into buf. Returns the number of bytes actually read if successful, and throws an error if there aren’t enough bytes to read. # Errors

Will return Err if the cursor position exceeds maximum possible vector length

Writes all of buf to the Bytecursor until buf is empty.

Errors

Will return Err if the cursor position exceeds maximum possible vector length or we failed to write whole buffer

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. 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

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

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

recently added

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.