From: Ian Jackson Date: Sat, 15 May 2021 22:58:51 +0000 (+0100) Subject: shapelib: Put LibraryEnquiryData in ItemEnquiryData X-Git-Tag: otter-0.6.0~246 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=581d0a2b5f2eb67dab8031ea854b2c7c90887d57;p=otter.git shapelib: Put LibraryEnquiryData in ItemEnquiryData Signed-off-by: Ian Jackson --- diff --git a/src/bin/otter.rs b/src/bin/otter.rs index 514b3de3..b3091326 100644 --- a/src/bin/otter.rs +++ b/src/bin/otter.rs @@ -1288,7 +1288,7 @@ mod library_add { } }; let spec = shapelib::ItemSpec { - lib: it.libname.clone(), + lib: it.lib.libname.clone(), item: it.itemname.as_str().to_owned(), }; let spec = PiecesSpec { diff --git a/src/bin/otterlib.rs b/src/bin/otterlib.rs index 73f0bd1f..d2769acf 100644 --- a/src/bin/otterlib.rs +++ b/src/bin/otterlib.rs @@ -93,7 +93,10 @@ fn preview(items: Vec) { } let mut pieces: Vec = items.into_iter().map(|it| { - let spec = ItemSpec { lib: it.libname.into(), item: it.itemname.into() }; + let spec = ItemSpec { + lib: it.lib.libname.into(), + item: it.itemname.into(), + }; let sortkey = it.sortkey; (||{ let (p, _occultable) = spec.clone() diff --git a/src/shapelib.rs b/src/shapelib.rs index c68cee13..73ad43e8 100644 --- a/src/shapelib.rs +++ b/src/shapelib.rs @@ -221,7 +221,7 @@ impl OccultedPieceTrait for ItemOccultable { #[derive(Debug,Clone,Serialize,Deserialize,Eq,PartialEq,Ord,PartialOrd)] pub struct ItemEnquiryData { - pub libname: String, + pub lib: LibraryEnquiryData, pub itemname: GoodItemName, pub sortkey: Option, pub f0desc: Html, @@ -231,7 +231,7 @@ pub struct ItemEnquiryData { impl Display for ItemEnquiryData { #[throws(fmt::Error)] fn fmt(&self, f: &mut Formatter) { - write!(f, "{:<10} {:20} {}", &self.libname, &self.itemname, + write!(f, "{:<10} {:20} {}", &self.lib, &self.itemname, self.f0desc.as_html_str())?; } } @@ -600,7 +600,7 @@ impl Contents { }; let f0bbox = loaded.bbox_approx()?; let ier = ItemEnquiryData { - libname: self.libname.clone(), + lib: self.enquiry(), itemname: (**k).to_owned(), sortkey: v.sort.to_owned(), f0bbox,