use std::{
io::{BufRead, BufReader, Cursor},
path::Path,
};
use crate::SemanticScene;
pub mod mp3d;
pub use mp3d::{Mp3dLoader, Mp3dOptions};
pub trait SemanticSceneLoader {
type Options: Default;
type Error;
fn from_reader<R: BufRead>(
reader: R,
options: Self::Options,
) -> Result<SemanticScene, Self::Error>;
fn from_str(input: &str, options: Self::Options) -> Result<SemanticScene, Self::Error> {
Self::from_reader(Cursor::new(input), options)
}
fn from_path(
path: impl AsRef<Path>,
options: Self::Options,
) -> Result<SemanticScene, Self::Error>
where
Self::Error: From<std::io::Error>,
{
let file = std::fs::File::open(path)?;
Self::from_reader(BufReader::new(file), options)
}
}