chiark / gitweb /
daemon: api route macros: tolerate attrs on structs
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 31 Jan 2021 00:48:35 +0000 (00:48 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 31 Jan 2021 00:50:02 +0000 (00:50 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
daemon/api.rs

index 82ffe35640654579d3aed04d19ba2478b9e2b0b4..9fa897567b25021ecf08e4ae81467d219654931f 100644 (file)
@@ -195,22 +195,22 @@ macro_rules! api_route_core {
 
 macro_rules! api_route {
   { $fn:ident, $path:expr,
-    struct $form:ident { $( $body:tt )* }
+    $( #[ $attrs:meta ] )* struct $form:ident { $( $body:tt )* }
     $( $impl:tt )*
   } => {
     api_route_core!{
       $fn, $path, $form,
-      struct $form { $( $body )* },
+      $( #[ $attrs ] )* struct $form { $( $body )* },
       $( $impl )*
     }
   };
   { $fn:ident, $path:expr,
-    struct $form:ident ( $( $body:tt )* );
+    $( #[ $attrs:meta ] )* struct $form:ident ( $( $body:tt )* );
     $( $impl:tt )*
   } => {
     api_route_core!{
       $fn, $path, $form,
-      struct $form ( $( $body )* );,
+      $( #[ $attrs ] )* struct $form ( $( $body )* );,
       $( $impl )*
     }
   }