aboutsummaryrefslogtreecommitdiffstats
path: root/src/document_tree/element_categories.rs
diff options
context:
space:
mode:
authorPhilipp A2018-11-19 21:26:38 +0100
committerPhilipp A2018-11-19 21:26:38 +0100
commitde6c16c95806a5d26779c3bc96241dfcab1f18ec (patch)
tree8283ca8371e547a6770180e918d910e2cc3cfc30 /src/document_tree/element_categories.rs
parent4272b19a79f786c6121e6c18c5aa4da4a4b2e02a (diff)
downloadrust-rst-de6c16c95806a5d26779c3bc96241dfcab1f18ec.tar.bz2
Make it compile again
Diffstat (limited to 'src/document_tree/element_categories.rs')
-rw-r--r--src/document_tree/element_categories.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/document_tree/element_categories.rs b/src/document_tree/element_categories.rs
index bc2e347..3a14b16 100644
--- a/src/document_tree/element_categories.rs
+++ b/src/document_tree/element_categories.rs
@@ -1,5 +1,7 @@
use std::fmt::{self,Debug,Formatter};
+use serde::{Serialize,Serializer};
+
use super::elements::*;
pub trait HasChildren<C> {
@@ -31,6 +33,14 @@ macro_rules! synonymous_enum {( $name:ident { $( $entry:ident ),* } ) => (
}
}
+ impl Serialize for $name {
+ fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: Serializer {
+ match self {
+ $( $name::$entry(ref inner) => inner.serialize(serializer), )*
+ }
+ }
+ }
+
$(
impl Into<$name> for $entry {
fn into(self) -> $name {