Struct diny::buffer::BufferState [−][src]
pub struct BufferState<const LEN: usize> {
pub cur: BufferCursor,
// some fields omitted
}
Expand description
A convenient struct to represent serialization of an underlying byte buffer.
Generally useful for primitive times (e.g. u64, str) that need to serialize multiple bytes using a predetermined buffer.
Fields
cur: BufferCursor
Implementations
Initialize a new buffer state with the contents of
the provided buf
.
Initialize a new buffer state with the contents of
the first n
bytes of the provided buf
.
Initialize a new buffer state and zeroize its contents.
Return a slice referencing the entire contents of the buffer.
Return whether or not more data is expected to be processed.
Extend the size of the interal buffer window to acoomodate more data.
This will only extend the buffer up to the size of the pre-allocated buffer. It is intended to be used when the total number of bytes is not known ahead of time and will be deserialized as part of the buffer transfer.
pub fn start_write<W>(
&mut self,
writer: &mut W,
cx: &mut Context<'_>
) -> PollEncodeStatus<Error> where
W: AsyncWrite + Unpin,
pub fn write_remaining<W>(
&mut self,
writer: &mut W,
cx: &mut Context<'_>
) -> PollEncodeStatus<Error> where
W: AsyncWrite + Unpin,
pub fn write_remaining<W>(
&mut self,
writer: &mut W,
cx: &mut Context<'_>
) -> PollEncodeStatus<Error> where
W: AsyncWrite + Unpin,
Attempt to write all remaining bytes from the buffer.
pub fn start_read<R>(
&mut self,
reader: &mut R,
cx: &mut Context<'_>
) -> PollDecodeStatus<(), Error> where
R: AsyncRead + Unpin,
pub fn read_remaining<R>(
&mut self,
reader: &mut R,
cx: &mut Context<'_>
) -> PollDecodeStatus<(), Error> where
R: AsyncRead + Unpin,
pub fn read_remaining<R>(
&mut self,
reader: &mut R,
cx: &mut Context<'_>
) -> PollDecodeStatus<(), Error> where
R: AsyncRead + Unpin,
Attempt to read all remaining bytes into the buffer.