From: Ian Jackson Date: Mon, 1 Feb 2021 01:19:35 +0000 (+0000) Subject: visible slotmap keys: Break out impl_for_slotmap_key X-Git-Tag: otter-0.4.0~557 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=c04d51b0a127ccf2f54f110fb9ceb66334d5a254;p=otter.git visible slotmap keys: Break out impl_for_slotmap_key Signed-off-by: Ian Jackson --- diff --git a/src/keydata.rs b/src/keydata.rs index 89d5e846..48766e32 100644 --- a/src/keydata.rs +++ b/src/keydata.rs @@ -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!