Trait genio::bufio::BufReadProgress
[−]
[src]
pub trait BufReadProgress: Read { type BufReadError; fn fill_progress(
&mut self
) -> Result<&[u8], BufError<Self::BufReadError, Self::ReadError>>; fn require_bytes(
&mut self,
amount: usize
) -> Result<&[u8], BufError<Self::BufReadError, Self::ReadError>>; }
When reading from reader, sometimes it's beneficial to read n
bytes at once. However, BufRead
itself doesn't guarantee that more bytes will be available when calling fill_buf
multiple
times. This trait provides fill_progress
and require_bytes
functions with that guarantee.
Associated Types
type BufReadError
Error that occurs in buffer itself. Most often if buffer is out of memory.
Required Methods
fn fill_progress(
&mut self
) -> Result<&[u8], BufError<Self::BufReadError, Self::ReadError>>
&mut self
) -> Result<&[u8], BufError<Self::BufReadError, Self::ReadError>>
Fills the internal buffer guaranteeing that successive calls to this function return more and more bytes (or an error).
fn require_bytes(
&mut self,
amount: usize
) -> Result<&[u8], BufError<Self::BufReadError, Self::ReadError>>
&mut self,
amount: usize
) -> Result<&[u8], BufError<Self::BufReadError, Self::ReadError>>
Fill the buffer until at least amount
bytes are available.