chiark / gitweb /
serde_with_compat: Move to utils.rs where it belongs
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 17 Apr 2022 20:00:49 +0000 (21:00 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 17 Apr 2022 20:21:12 +0000 (21:21 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/occultilks.rs
src/prelude.rs
src/utils.rs

index b742d6b2e1c28feb7a72b7701636fd11539f05ac..eb00577706e8eca4d90b45f914bc01d2f725e4fd 100644 (file)
@@ -38,21 +38,6 @@ pub enum LOccultIlk {
   Mix(OccultIlkName),
 }
 
-macro_rules! serde_with_compat { {
-  [ #[ $($attrs:meta)* ] ] [ $vis:vis ] [ $($intro:tt)* ]
-    $main:ident=$main_s:literal $new:ident $compat_s:literal
-  [ $($body:tt)* ]
-} => {
-  $(#[ $attrs ])* 
-  #[serde(try_from=$compat_s)]
-  $vis $($intro)* $main $($body)*
-
-  #[allow(non_camel_case_types)]
-  $(#[ $attrs ])* 
-  #[serde(remote=$main_s)]
-  $($intro)* $new $($body)*
-} }
-
 serde_with_compat!{
   [ #[derive(Debug,Serialize,Deserialize)] ]
   [ pub ][ enum ] IOccultIlk="IOccultIlk" IOccultIlk_New "IOccultIlk_Compat" [
index c9ea63c4db88f8f8cec6ffeb4f869679482a7a29..05de71236dbfb973ba268be0243ff787c1c229e4 100644 (file)
@@ -136,6 +136,7 @@ pub use crate::format_by_fmt_hex;
 pub use crate::matches_doesnot;
 pub use crate::trace_dbg;
 pub use crate::{want, wantok, wants, want_let, want_failed_internal};
+pub use crate::serde_with_compat;
 
 pub use crate::accounts::loaded_acl::{self, EffectiveACL, LoadedAcl, PermSet};
 pub use crate::accounts::*;
index 967950483ca3f97224372fd7583acfdc4d732bda..88b0317638f7d0bc9c6c52fcb0c6cb01a9157d37 100644 (file)
@@ -406,6 +406,22 @@ macro_rules! want_let {
   };
 }
 
+#[macro_export]
+macro_rules! serde_with_compat { {
+  [ #[ $($attrs:meta)* ] ] [ $vis:vis ] [ $($intro:tt)* ]
+    $main:ident=$main_s:literal $new:ident $compat_s:literal
+  [ $($body:tt)* ]
+} => {
+  $(#[ $attrs ])* 
+  #[serde(try_from=$compat_s)]
+  $vis $($intro)* $main $($body)*
+
+  #[allow(non_camel_case_types)]
+  $(#[ $attrs ])* 
+  #[serde(remote=$main_s)]
+  $($intro)* $new $($body)*
+} }
+
 macro_rules! entry_define_insert_remove {
   { $name:ident, $name_mod:ident, $entry:path, $into_key:ident } =>
   {