From 79605e6ae1177bc9366507fe5862047c4137cf91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Flemstr=C3=B6m?= Date: Mon, 22 Nov 2021 18:46:58 +0100 Subject: [PATCH] Add support for struct attribute macros --- src/struct.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/struct.rs b/src/struct.rs index 8feae8a..4ce0d5c 100644 --- a/src/struct.rs +++ b/src/struct.rs @@ -75,6 +75,12 @@ impl Struct { self } + /// Add a macro to the struct def (e.g. `"#[serde(...)]"`) + pub fn r#macro(&mut self, name: &str) -> &mut Self { + self.type_def.r#macro(name); + self + } + /// Push a named field to the struct. /// /// A struct can either set named fields with this function or tuple fields