fn load_filedata(filename: &OsStr) -> Result<memmap::Mmap, String> {
    let file = match File::open(filename) {
        Ok(file) => file,
        Err(error) => return Err(format!("Error: could not open file {}: {}", filename.to_string_lossy(), error))
    };

    match unsafe { memmap::Mmap::map(&file) } {
        Ok(mmap) => Ok(mmap),
        Err(err) => {
            return Err(format!("Error: Failed to map file '{}': {}", filename.to_string_lossy(), err));
        }
    }
}
// open a file and mmap its content
open a file and mmap its content
open a file and mmap its content
fn load_filedata(filename: &OsStr) -> Result<memmap::Mmap, String> {
    let file = match File::open(filename) {
        Ok(file) => file,
        Err(error) => return Err(format!("Error: could not open file {}: {}", filename.to_string_lossy(), error))
    };
    match unsafe { memmap::Mmap::map(&file) } {
        Ok(mmap) => Ok(mmap),
        Err(err) => {
            return Err(format!("Error: Failed to map file '{}': {}", filename.to_string_lossy(), err));
        }
    }
}
fn load_filedata ( filename : & OsStr ) -> Result < memmap :: Mmap , String > { let file = match File :: open ( filename ) { Ok ( file ) => file , Err ( error ) => return Err ( format ! ( " " filename to_string_lossy ( ) error ) ) } ; match unsafe { memmap :: Mmap :: map ( & file ) } { Ok ( mmap ) => Ok ( mmap ) , Err ( err ) => { return Err ( format ! ( " " filename to_string_lossy ( ) err ) ) ; } } }
open a file and mmap its content
open a file and mmap its content
filename
&OsStr