From: Ian Jackson Date: Tue, 16 Mar 2021 12:02:31 +0000 (+0000) Subject: hidden: Make PieceRenderInstructions deref to PriOcculted X-Git-Tag: otter-0.4.0~19 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=52d817a5c9c1ec9e4ba01818f59cfe9233a87945;p=otter.git hidden: Make PieceRenderInstructions deref to PriOcculted This makes call sites somewhat nicer, especially as we move more stuff. Signed-off-by: Ian Jackson --- diff --git a/src/pcrender.rs b/src/pcrender.rs index 72562950..4530b100 100644 --- a/src/pcrender.rs +++ b/src/pcrender.rs @@ -16,6 +16,7 @@ pub struct PieceRenderInstructions { pub vpid: VisiblePieceId, pub occulted: PriOcculted, } +deref_to_field!{PieceRenderInstructions, PriOcculted, occulted} #[derive(Debug,Clone)] pub enum PriOccultedGeneral { @@ -135,7 +136,7 @@ impl PieceRenderInstructions { gpc: &GPiece, ipc: &IPiece) -> Html { let pri = self; - let instead = pri.occulted.instead(ioccults, ipc)?; + let instead = pri.instead(ioccults, ipc)?; let o: &dyn OutlineTrait = match instead { Left(_) => Borrow::::borrow(&ipc.p).dyn_upcast(), @@ -186,7 +187,7 @@ impl PieceRenderInstructions { #[throws(IE)] pub fn describe_fallible(&self, ioccults: &IOccults, gpc: &GPiece, ipc: &IPiece) -> Html { - match self.occulted.instead(ioccults, ipc)? { + match self.instead(ioccults, ipc)? { Left(_y) => ipc.p.describe_html(gpc)?, Right(i) => i.describe_html()?, }