Struct diny::buffer::BufferCursor[][src]

pub struct BufferCursor { /* fields omitted */ }
Expand description

Retains the current index state into a serialization buffer.

Typically used by a BufferState to keep track of which bytes still require processing.

Implementations

Instantiate a new cursor over the beginning of the provided buf.

Instantiate a new cursor representing the beginning of a buffer with a specified len.

Return the number of bytes the cursor has processed so far.

Return whether or not any bytes have been processed yet.

Return whether or not more data is expected to be processed.

Attempt to write all of the bytes in data, starting from the current offset of the cursor.

This implementation differs from a typical AsyncWrite operation in that the contents of data are expected to be unchanging from one call to the next, despite progress being made. The expectation is that the caller does not need to retain any information about the progress of the write, and simply needs to pass in the same references for each call.

Attempt to read all remaining bytes that are expected into data, starting from the current offset of the cursor.

This implementation differs from a typical AsyncRead operation in that the contents of data are expected to be unchanging from one call to the next, despite progress being made. The expectation is that the caller does not need to retain any information about the progress of the read, and simply needs to pass in the same references for each call.

This is supported on crate features std or alloc only.

Semantically equivalent to read_remaining, only this method takes advantage of the AsyncBufRead trait to minimize the number of copies required to transfer the bytes into a pre-allocated Vec.

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 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.