From a7143b412cb4f33a6e04d80765d060f7fc024066 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 15 May 2021 19:39:57 +0100 Subject: [PATCH] shapelib: Break out Registry::add() Signed-off-by: Ian Jackson --- src/shapelib.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/shapelib.rs b/src/shapelib.rs index 11205dee..4d9eaec8 100644 --- a/src/shapelib.rs +++ b/src/shapelib.rs @@ -347,6 +347,14 @@ impl OccultedPieceTrait for Item { } } +impl Registry { + pub fn add(&mut self, data: Contents) { + self.libs + .entry(data.libname.clone()).or_default() + .push(data); + } +} + pub struct AllRegistries<'ig> { global: RwLockReadGuard<'static, Option>, #[allow(dead_code)] ig: &'ig Instance, @@ -821,9 +829,7 @@ pub fn load_1_global_library(l: &Explicit1) { let count = data.items.len(); GLOBAL_SHAPELIBS.write() .get_or_insert_with(default) - .libs - .entry(l.name.clone()).or_default() - .push(data); + .add(data); info!("loaded {} shapes in library {:?} from {:?} and {:?}", count, &l.name, &l.catalogue, &l.dirname); } -- 2.30.2