pub fn read_exact(stream: &mut dyn Read, len: usize) -> Result<Vec<u8>> {
    let mut buf = Vec::with_capacity(len);
    unsafe {
        buf.set_len(len);
    }
    read_array(stream, &mut buf[..])?;
    Ok(buf)
}
/// Reads exactly `len` bytes and gives you back a new vector of length
/// `len`
///
/// # Error
///
/// Fails with the same conditions as `read`. Additionally returns error
/// on EOF. Note that if an error is returned, then some number of bytes may
/// have already been consumed from the underlying reader, and they are lost
/// (not returned as part of the error). If this is unacceptable, then it is
/// recommended to use the `push_at_least` or `read` methods.
Reads exactly `len` bytes and gives you back a new vector of length
`len`
Reads exactly ` len ` bytes and gives you back a new vector of length ` len `
pub fn read_exact(stream: &mut dyn Read, len: usize) -> Result<Vec<u8>> {
    let mut buf = Vec::with_capacity(len);
    unsafe {
        buf.set_len(len);
    }
    read_array(stream, &mut buf[..])?;
    Ok(buf)
}
pub fn read_exact ( stream : & mut dyn Read , len : usize ) -> Result < Vec < u8 > > { let mut buf = Vec :: with_capacity ( len ) ; unsafe { buf . set_len ( len ) ; } read_array ( stream , & mut buf [ .. ] ) ? ; Ok ( buf ) }
Reads exactly `len` bytes and gives you back a new vector of length
`len`
Reads exactly ` len ` bytes and gives you back a new vector of length ` len `
stream
&mut dyn Read
len
usize
stream
&mut dyn Read
len
usize
error
Fails with the same conditions as `read`. Additionally returns error
on EOF. Note that if an error is returned, then some number of bytes may
have already been consumed from the underlying reader, and they are lost
(not returned as part of the error). If this is unacceptable, then it is
recommended to use the `push_at_least` or `read` methods.
Fails with the same conditions as ` read ` . Additionally returns error on EOF . Note that if an error is returned then some number of bytes may have already been consumed from the underlying reader and they are lost ( not returned as part of the error ) . If this is unacceptable then it is recommended to use the ` push_at_least ` or ` read ` methods .