diff options
| author | Philipp A | 2019-03-30 18:02:40 +0100 |
|---|---|---|
| committer | Philipp A | 2019-03-30 18:02:40 +0100 |
| commit | 626cc2d747f198ba94bac241a872927968f50431 (patch) | |
| tree | 27bb6689b3285de27a7e963676b62e6e8d53e5aa /src/document_tree/extra_attributes.rs | |
| parent | 647d667b7cc63aa2f3ad3fa84c5d892bded0be5b (diff) | |
| download | rust-rst-626cc2d747f198ba94bac241a872927968f50431.tar.bz2 | |
Skip empty attributes
Diffstat (limited to 'src/document_tree/extra_attributes.rs')
| -rw-r--r-- | src/document_tree/extra_attributes.rs | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/document_tree/extra_attributes.rs b/src/document_tree/extra_attributes.rs index 0708080..d73cdec 100644 --- a/src/document_tree/extra_attributes.rs +++ b/src/document_tree/extra_attributes.rs @@ -1,7 +1,7 @@ use serde_derive::Serialize; use crate::target; -use super::attribute_types::{FixedSpace,ID,NameToken,AlignHV,AlignH,Measure,EnumeratedListType}; +use super::attribute_types::{CanBeEmpty,FixedSpace,ID,NameToken,AlignHV,AlignH,Measure,EnumeratedListType}; pub trait ExtraAttributes<A> { fn with_extra(extra: A) -> Self; @@ -9,14 +9,6 @@ pub trait ExtraAttributes<A> { fn extra_mut(&mut self) -> &mut A; } -/* -macro_rules! skip { - (Option<$type:ty>) => { #[serde(skip_serializing_if = "Option::is_none")] }; - (Vec <$type:ty>) => { #[serde(skip_serializing_if = "Vec::is_empty" )] }; - (bool ) => { #[serde(skip_serializing_if = "Not::not" )] }; -} -*/ - macro_rules! impl_extra { ( $name:ident { $( $(#[$pattr:meta])* $param:ident : $type:ty ),* $(,)* } ) => ( impl_extra!( @@ -28,7 +20,7 @@ macro_rules! impl_extra { $(#[$attr])+ pub struct $name { $( $(#[$pattr])* - // skip!($type) + #[serde(skip_serializing_if = "CanBeEmpty::is_empty")] pub $param : $type, )* } ); |
