Skip to content

Instantly share code, notes, and snippets.

@jeremiahbiard
Created June 3, 2018 02:01
Show Gist options
  • Save jeremiahbiard/fbb99c87de19d9a72276c2cb5c48d79f to your computer and use it in GitHub Desktop.
Save jeremiahbiard/fbb99c87de19d9a72276c2cb5c48d79f to your computer and use it in GitHub Desktop.
load_rom function
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