chiark / gitweb /
bundles: Provide Display for Id
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 2 May 2021 20:54:27 +0000 (21:54 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 2 May 2021 20:54:27 +0000 (21:54 +0100)
Nothing uses this yet but maybe it will be useful.

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

index 948aca7e1af264a5feec9fc54a6ebc5ba2dd41bb..b9c56bfd0dcd20696632184d35b7418286d7ade6 100644 (file)
@@ -88,6 +88,13 @@ where S: Display + Debug
           index, suffix)
 }
 
+impl Display for Id {
+  #[throws(fmt::Error)]
+  fn fmt(&self, f: &mut fmt::Formatter) {
+    write!(f, "{}.{}", self.index, self.kind)?
+  }
+}
+
 impl Id {
   fn path_tmp(&self, instance: &InstanceName) -> String {
     b_file(instance, self.index, "tmp")