chiark / gitweb /
visible slotmap keys: Break out impl_for_slotmap_key
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 1 Feb 2021 01:19:35 +0000 (01:19 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 1 Feb 2021 01:19:35 +0000 (01:19 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/keydata.rs

index 89d5e84684c1c346587b969e3273673e42eb0d4a..48766e32c98b8e09496eb852e048b69a4536b5f8 100644 (file)
@@ -52,6 +52,12 @@ macro_rules! visible_slotmap_key {
     #[serde(try_from="String")]
     pub struct $x(pub slotmap::KeyData);
 
+    impl_for_slotmap_key!($x($sep));
+  }
+}
+#[macro_export]
+macro_rules! impl_for_slotmap_key {
+  ( $x:ident($sep:expr) ) => {
     impl Display for $x {
       #[throws(fmt::Error)]
       fn fmt(&self, f: &mut fmt::Formatter) { slotkey_write(self.0,$sep,f)? }
@@ -84,3 +90,4 @@ macro_rules! visible_slotmap_key {
   }
 }
 pub use crate::visible_slotmap_key; // this is madness!
+pub use crate::impl_for_slotmap_key; // this is madness!