Trait buf_read_ext::BufReadExt
[−]
[src]
pub trait BufReadExt: BufRead { fn stream_until_token<W: Write>(&mut self, token: &[u8], out: &mut W) -> Result<usize> { ... } }
Extends any type that implements BufRead with a stream_until_token() function.
Provided Methods
fn stream_until_token<W: Write>(&mut self, token: &[u8], out: &mut W) -> Result<usize>
Streams all bytes to out
until the token
delimiter is reached.
This function will continue to read (and stream) bytes from the underlying stream until the
token or end-of-file byte is found. Once found, all bytes up to the token (if found) will
have been streamed to out
and this input stream will advance past the token (the token
will be discarded).
This function will return Ok(n)
where n
is the number of bytes which were read,
including the token if it was found. If the token was not found, it will still return
Ok(n)
.
Errors
This function will ignore all instances of ErrorKind::Interrupted
and will otherwise
return any errors returned by fill_buf
.
Implementors
impl<T: BufRead> BufReadExt for T