1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
use std::fmt; pub type LoadResult = Result<String, LoadError>; #[derive(Debug, PartialEq)] pub enum LoadError { BadName(String), IoError(String), NotFound, } pub trait Loader: fmt::Debug + Send + Sync { fn load(&self, name: &str) -> LoadResult; }