19 lines
373 B
Rust
19 lines
373 B
Rust
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()
|
|
}
|
|
}
|
|
}
|