diff --git a/martin/src/sprites/mod.rs b/martin/src/sprites/mod.rs index 05900d34c..05e17694b 100644 --- a/martin/src/sprites/mod.rs +++ b/martin/src/sprites/mod.rs @@ -71,9 +71,7 @@ impl ConfigExtras for SpriteConfig { } #[derive(Debug, Clone, Default)] -pub struct SpriteSources { - sources: HashMap, -} +pub struct SpriteSources(HashMap); impl SpriteSources { pub fn resolve(config: &mut FileConfigEnum) -> FileResult { @@ -112,7 +110,7 @@ impl SpriteSources { pub fn get_catalog(&self) -> SpriteResult { // TODO: all sprite generation should be pre-cached let mut entries = SpriteCatalog::new(); - for (id, source) in &self.sources { + for (id, source) in &self.0 { let paths = get_svg_input_paths(&source.path, true) .map_err(|e| SpriteProcessingError(e, source.path.clone()))?; let mut images = Vec::with_capacity(paths.len()); @@ -133,7 +131,7 @@ impl SpriteSources { if path.is_file() { warn!("Ignoring non-directory sprite source {id} from {disp_path}"); } else { - match self.sources.entry(id) { + match self.0.entry(id) { Entry::Occupied(v) => { warn!("Ignoring duplicate sprite source {} from {disp_path} because it was already configured for {}", v.key(), v.get().path.display()); @@ -158,7 +156,7 @@ impl SpriteSources { let sprite_ids = ids .split(',') .map(|id| { - self.sources + self.0 .get(id) .ok_or_else(|| SpriteError::SpriteNotFound(id.to_string())) }) @@ -242,7 +240,7 @@ mod tests { PathBuf::from("../tests/fixtures/sprites/src2"), ]); - let sprites = SpriteSources::resolve(&mut cfg).unwrap().sources; + let sprites = SpriteSources::resolve(&mut cfg).unwrap().0; assert_eq!(sprites.len(), 2); //.sdf => generate sdf from png, add sdf == true