Files
peachy/src/music.rs

19 lines
373 B
Rust
Raw Permalink Normal View History

2021-05-18 00:05:39 +01:00
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<u8>,
}
impl Music {
pub fn from_file(path: PathBuf) -> Self {
Self {
name: path.file_stem().unwrap().to_str().unwrap().into(),
bytes: fs::read(path).unwrap()
}
}
}