Trait codec::buffer::BufferReader [−][src]
A trait to provide sequential read over a memory buffer.
The memory buffer can be &[u8]
or std::io::Cursor<AsRef<[u8]>>
.
Required methods
fn bytes(&self) -> &[u8]
[src]
Returns a slice starting at current position.
The returned slice can be empty.
fn advance(&mut self, count: usize)
[src]
Advances the position of internal cursor.
Panics
This function may panic in some implementors when remaining space is not large enough to advance.
TODO: We should make the panic behaviour deterministic.
fn read_bytes(&mut self, count: usize) -> Result<&[u8]>
[src]
Read next several bytes as a slice and advance the position of internal cursor.
Errors
Returns Error::Io
if there is not enough space to read specified number of bytes.