use std::{fs, io};
use std::path::Path;
pub struct Program(Vec<u8>);
impl Program {
pub fn from_file<P: AsRef<Path>>(path: P) -> io::Result<Program> {
fs::read(path).map(Self::from_iter)
}
pub fn from_iter<I: IntoIterator<Item=u8>>(iter: I) -> Program {
Program(iter.into_iter().collect())
}
pub fn memory(&self) -> &[u8] {
&self.0
}
}