Function netio::copy_until [] [src]

pub fn copy_until<R: ?Sized, W: ?Sized>(
    reader: &mut R,
    writer: &mut W,
    delim: u8
) -> Result<()> where
    R: BufRead,
    W: Write

Copies the content of a buffered reader into a writer until a delimiter is reached.

This function will continuously read data from reader and then write it into writer in a streaming fashion until until the delimiter or EOF is found.

Errors

This function will return an error immediately if any call to fill_buf or write returns any kind of error. Instances of ErrorKind::Interrupted are not handled by this function.

All bytes consumed from the buffered reader will be written to the specified writer and vice versa. It is guaranteed that no data is lost in case of error.