From: Ian Jackson Date: Tue, 16 Mar 2021 12:04:18 +0000 (+0000) Subject: hidden: Make describe* be methods on PriOcculted X-Git-Tag: otter-0.4.0~18 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=61a0c3b6b9ab4c090434c71a767a708f25308824;p=otter.git hidden: Make describe* be methods on PriOcculted So we can call them when we only have one of those. Signed-off-by: Ian Jackson --- diff --git a/src/pcrender.rs b/src/pcrender.rs index 4530b100..6e2293ff 100644 --- a/src/pcrender.rs +++ b/src/pcrender.rs @@ -63,6 +63,25 @@ impl PriOccultedGeneral { }, } } + + pub fn describe(&self, ioccults: &IOccults, + gpc: &GPiece, ipc: &IPiece) -> Html + { + self.describe_fallible(ioccults, gpc, ipc) + .unwrap_or_else(|e| { + error!("error describing piece: {:?}", e); + Html::lit("") + }) + } + + #[throws(IE)] + pub fn describe_fallible(&self, ioccults: &IOccults, + gpc: &GPiece, ipc: &IPiece) -> Html { + match self.instead(ioccults, ipc)? { + Left(_y) => ipc.p.describe_html(gpc)?, + Right(i) => i.describe_html()?, + } + } } impl PieceRenderInstructions { @@ -174,25 +193,6 @@ impl PieceRenderInstructions { defs } - pub fn describe(&self, ioccults: &IOccults, - gpc: &GPiece, ipc: &IPiece) -> Html - { - self.describe_fallible(ioccults, gpc, ipc) - .unwrap_or_else(|e| { - error!("error describing piece: {:?}", e); - Html::lit("") - }) - } - - #[throws(IE)] - pub fn describe_fallible(&self, ioccults: &IOccults, - gpc: &GPiece, ipc: &IPiece) -> Html { - match self.instead(ioccults, ipc)? { - Left(_y) => ipc.p.describe_html(gpc)?, - Right(i) => i.describe_html()?, - } - } - #[throws(InternalError)] pub fn ui_operations(&self, gpc: &GPiece, p: &dyn PieceTrait) -> Vec