use std::fs; use std::path::PathBuf; /// an XM music file. /// name is derived from the file stem. pub struct Music { pub name: String, pub bytes: Vec, } impl Music { pub fn from_file(path: PathBuf) -> Self { Self { name: path.file_stem().unwrap().to_str().unwrap().into(), bytes: fs::read(path).unwrap() } } }