fn contents_as_bytes(mut file: File) -> Result<Vec<u8>, Box<dyn Error>> {
    let metadata = file.metadata()?;

    let mut contents: Vec<u8> = Vec::with_capacity(metadata.len() as usize + 1);

    file.read_to_end(&mut contents)?;

    Ok(contents)
}
/// Reads the given file and returns it's contents as bytes.
Reads the given file and returns it's contents as bytes.
Reads the given file and returns it ' s contents as bytes .
fn contents_as_bytes(mut file: File) -> Result<Vec<u8>, Box<dyn Error>> {
    let metadata = file.metadata()?;
    let mut contents: Vec<u8> = Vec::with_capacity(metadata.len() as usize + 1);
    file.read_to_end(&mut contents)?;
    Ok(contents)
}
fn contents_as_bytes ( mut file : File ) -> Result < Vec < u8 > , Box < dyn Error > > { let metadata = file . metadata ( ) ? ; let mut contents : Vec < u8 > = Vec :: with_capacity ( metadata . len ( ) as usize + 1 ) ; file . read_to_end ( & mut contents ) ? ; Ok ( contents ) }
Reads the given file and returns it's contents as bytes.
Reads the given file and returns it ' s contents as bytes .
file
File
file
File