Function rmp::decode::read_full [] [src]

pub fn read_full<R: Read>(rd: &mut R, buf: &mut [u8]) -> Result<usize, Error>

Copies the contents of a reader into a buffer until fully filled.

This function will continuously read data from rd and then write it into buf in a streaming fashion until rd returns EOF.

On success the total number of bytes that were copied from rd to buf is returned. Note, that reaching EOF is not treated as error.

Errors

This function will return an error immediately if any call to read returns an error. All instances of ErrorKind::Interrupted are handled by this function and the underlying operation is retried.