From b237ecd759476a6661ba940462663eea54091924 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 4 May 2022 20:43:24 +0100 Subject: [PATCH] shapelib: Rename Catalogue from Contents The old name was vague and confusing. Signed-off-by: Ian Jackson --- src/bundles.rs | 2 +- src/shapelib.rs | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/bundles.rs b/src/bundles.rs index f728adb8..075b482d 100644 --- a/src/bundles.rs +++ b/src/bundles.rs @@ -102,7 +102,7 @@ define_index_type!{ pub struct LibInBundleI = usize; } #[derive(Debug)] struct Parsed { meta: BundleMeta, - libs: IndexVec, + libs: IndexVec, specs: SpecsInBundles, size: usize, hash: Hash, diff --git a/src/shapelib.rs b/src/shapelib.rs index b64258c0..6ec011b3 100644 --- a/src/shapelib.rs +++ b/src/shapelib.rs @@ -19,7 +19,7 @@ static GLOBAL_SHAPELIBS: RwLock> = const_rwlock(None); #[derive(Default)] pub struct Registry { - libs: HashMap>, + libs: HashMap>, } #[derive(Debug)] @@ -37,7 +37,7 @@ pub trait OutlineDefn: Debug + Sync + Send + 'static { pub struct OutlineCalculable { } #[derive(Debug)] -pub struct Contents { +pub struct Catalogue { libname: String, dirname: String, bundle: Option, @@ -420,7 +420,7 @@ impl InertPieceTrait for Item { } impl Registry { - pub fn add(&mut self, data: Contents) { + pub fn add(&mut self, data: Catalogue) { self.libs .entry(data.libname.clone()).or_default() .push(data); @@ -430,7 +430,7 @@ impl Registry { self.libs.clear() } - pub fn iter(&self) -> impl Iterator { + pub fn iter(&self) -> impl Iterator { self.libs.values().map(|v| v.as_slice()) } } @@ -483,12 +483,12 @@ pub fn lib_name_list(ig: &Instance) -> Vec { } impl<'ig> AllRegistries<'ig> { - pub fn all_libs(&self) -> impl Iterator { + pub fn all_libs(&self) -> impl Iterator { self.iter().map(|reg| ®.libs).flatten().map( |(_libname, lib)| lib.as_slice() ) } - pub fn lib_name_lookup(&self, libname: &str) -> Result<&[Contents], SpE> { + pub fn lib_name_lookup(&self, libname: &str) -> Result<&[Catalogue], SpE> { for reg in self.iter() { if let Some(r) = reg.libs.get(libname) { return Ok(r) } } @@ -530,7 +530,7 @@ impl ItemSpec { } } -impl Contents { +impl Catalogue { #[throws(SpecError)] fn load_image(&self, item_name: &SvgBaseName, lib_name_for: &str, item_for: &str, @@ -756,9 +756,10 @@ impl LibrarySource for BuiltinLibrary<'_> { } #[throws(LibraryLoadError)] -pub fn load_catalogue(libname: &str, src: &mut dyn LibrarySource) -> Contents { +pub fn load_catalogue(libname: &str, src: &mut dyn LibrarySource) + -> Catalogue { let toplevel: toml::Value = src.catalogue_data().parse()?; - let mut l = Contents { + let mut l = Catalogue { bundle: src.bundle(), libname: libname.to_string(), items: HashMap::new(), -- 2.30.2