chiark / gitweb /
hidden: Make describe* be methods on PriOcculted
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 16 Mar 2021 12:04:18 +0000 (12:04 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 16 Mar 2021 12:05:28 +0000 (12:05 +0000)
So we can call them when we only have one of those.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/pcrender.rs

index 4530b100653d54e00c88cbebbe2970b066ba7c2c..6e2293ff7b654099d2c17963ceeae68deae3d56e 100644 (file)
@@ -63,6 +63,25 @@ impl<P,Z> PriOccultedGeneral<P,Z> {
       },
     }
   }
+
+  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("<internal error describing piece>")
+      })
+  }
+
+  #[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("<internal error describing piece>")
-      })
-  }
-
-  #[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<UoDescription>