From a7727da58c03dc46f26ed0653ef1569c7eab5c28 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 19 May 2022 20:36:15 +0100 Subject: [PATCH] currency: Break out describe() Signed-off-by: Ian Jackson --- src/currency.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/currency.rs b/src/currency.rs index 23d84ae3..bce79d67 100644 --- a/src/currency.rs +++ b/src/currency.rs @@ -112,9 +112,7 @@ impl PieceTrait for Banknote { #[throws(IE)] fn describe_html(&self, gpc: &GPiece, _: &GOccults) -> Html { let value: &Value = gpc.xdata.get_exp()?; - hformat!("{}, {}{}", - self.image.describe_html(gpc.face)?, - &value.html(), &self.currency) + self.describe(gpc.face, &value.html())? } #[throws(IE)] @@ -289,6 +287,13 @@ impl Value { } impl Banknote { + #[throws(IE)] + fn describe(&self, face: FaceId, qty: &HtmlStr) -> Html { + hformat!("{}, {}{}", + self.image.describe_html(face)?, + qty, &self.currency) + } + #[throws(IE)] fn render(&self, f: &mut Html, vpid: VisiblePieceId, face: FaceId, xdata_for_image_only: &PieceXDataState, qty: &HtmlStr) { -- 2.30.2