diff options
| author | Phil Schaf | 2015-11-14 23:24:56 +0100 | 
|---|---|---|
| committer | Phil Schaf | 2015-11-14 23:24:56 +0100 | 
| commit | 154165495d0db0227d0dc45f368f6dce1123a038 (patch) | |
| tree | 78ef11b3d0946b5b1a3c98ab3126f3a6a2a6bf15 /src/document_tree/element_categories.rs | |
| parent | 11d453f354c3bfd8f2c2f755c0246f3c2f526179 (diff) | |
| download | rust-rst-154165495d0db0227d0dc45f368f6dce1123a038.tar.bz2 | |
added some convenience conversions
Diffstat (limited to 'src/document_tree/element_categories.rs')
| -rw-r--r-- | src/document_tree/element_categories.rs | 17 | 
1 files changed, 12 insertions, 5 deletions
| diff --git a/src/document_tree/element_categories.rs b/src/document_tree/element_categories.rs index d8024ad..e9d07a6 100644 --- a/src/document_tree/element_categories.rs +++ b/src/document_tree/element_categories.rs @@ -1,3 +1,5 @@ +use std::fmt::{self,Debug,Formatter}; +  use super::elements::*;  pub trait HasChildren<C> { @@ -16,11 +18,16 @@ pub trait HasChildren<C> {  }  macro_rules! synonymous_enum {( $name:ident { $( $entry:ident ),* } ) => ( -	#[derive(Debug)]  	pub enum $name { -		$( -			$entry($entry), -		)* +		$( $entry($entry), )* +	} +	 +	impl Debug for $name { +		fn fmt(&self, fmt: &mut Formatter) -> Result<(), fmt::Error> { +			match self { +				$( &$name::$entry(ref inner) => inner.fmt(fmt), )* +			} +		}  	}  	$( @@ -46,7 +53,7 @@ synonymous_enum!(BodyElement {  synonymous_enum!(BibliographicElement { Author, Authors, Organization, Address, Contact, Version, Revision, Status, Date, Copyright, Field });  synonymous_enum!(TextOrInlineElement { -	TextElement, Emphasis, Strong, Literal, Reference, FootnoteReference, CitationReference, SubstitutionReference, TitleReference, Abbreviation, Acronym, Superscript, Subscript, Inline, Problematic, Generated, Math, +	String, Emphasis, Strong, Literal, Reference, FootnoteReference, CitationReference, SubstitutionReference, TitleReference, Abbreviation, Acronym, Superscript, Subscript, Inline, Problematic, Generated, Math,  	//also have non-inline versions. Inline image is no figure child, inline target has content  	TargetInline, RawInline, ImageInline  }); | 
