Created
June 3, 2018 02:01
-
-
Save jeremiahbiard/fbb99c87de19d9a72276c2cb5c48d79f to your computer and use it in GitHub Desktop.
load_rom function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn load_rom<'a, P: AsRef<Path>>(path: P) -> Result<&'a Vec<u8>, Box<Error>> { | |
let mut fh = fs::File::open(path)?; | |
let mut program: &'a mut Vec<u8> = &mut Vec::new(); | |
fh.read_to_end(&mut program)?; | |
Ok(program) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment