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
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
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for ByteCursor
impl Send for ByteCursor
impl Sync for ByteCursor
impl Unpin for ByteCursor
impl UnwindSafe for ByteCursor
Blanket Implementations
Mutably borrows from an owned value. Read more