fn load_file_contents<P: AsRef<Path>>(filename: P, dest: &mut Vec<u8>) -> Result<()> {
    let filename = filename.as_ref();

    let mut buffer = Vec::new();
    File::open(filename)?.read_to_end(&mut buffer)?;

    // We needed the buffer so we'd only overwrite the existing content if we
    // could successfully load the file into memory.
    dest.clear();
    dest.append(&mut buffer);

    Ok(())
}
/// Checks if a file exists, if so, the destination buffer will be filled with
/// its contents.
Checks if a file exists, if so, the destination buffer will be filled with
its contents.
Checks if a file exists if so the destination buffer will be filled with its contents .
fn load_file_contents<P: AsRef<Path>>(filename: P, dest: &mut Vec<u8>) -> Result<()> {
    let filename = filename.as_ref();
    let mut buffer = Vec::new();
    File::open(filename)?.read_to_end(&mut buffer)?;
    // We needed the buffer so we'd only overwrite the existing content if we
    // could successfully load the file into memory.
    dest.clear();
    dest.append(&mut buffer);
    Ok(())
}
fn load_file_contents < P : AsRef < Path > > ( filename : P , dest : & mut Vec < u8 > ) -> Result < ( ) > { let filename = filename . as_ref ( ) ; let mut buffer = Vec :: new ( ) ; File :: open ( filename ) ? . read_to_end ( & mut buffer ) ? ; // We needed the buffer so we'd only overwrite the existing content if we // could successfully load the file into memory. dest . clear ( ) ; dest . append ( & mut buffer ) ; Ok ( ( ) ) }
Checks if a file exists, if so, the destination buffer will be filled with
its contents.
Checks if a file exists if so the destination buffer will be filled with its contents .
filename
P
dest
&mut Vec<u8>
filename
P
dest
&mut Vec<u8>