diff options
| author | Phil Schaf | 2015-11-14 21:18:04 +0100 | 
|---|---|---|
| committer | Phil Schaf | 2015-11-14 21:18:04 +0100 | 
| commit | 1434756b2b6cedb3d56528ca1802a92be4eaba56 (patch) | |
| tree | 84a30e24279f2dda29fc4a7677ca6b79d40b04e6 /src/document_tree/element_categories.rs | |
| parent | 5fdb21df228c78061cce9ee910fa87da0fd99d46 (diff) | |
| download | rust-rst-1434756b2b6cedb3d56528ca1802a92be4eaba56.tar.bz2 | |
improved HasChildren trait
Diffstat (limited to 'src/document_tree/element_categories.rs')
| -rw-r--r-- | src/document_tree/element_categories.rs | 7 | 
1 files changed, 5 insertions, 2 deletions
| diff --git a/src/document_tree/element_categories.rs b/src/document_tree/element_categories.rs index 5f12cc6..9ea79e6 100644 --- a/src/document_tree/element_categories.rs +++ b/src/document_tree/element_categories.rs @@ -1,7 +1,10 @@  use super::elements::*;  pub trait HasChildren<C> { -	fn add_child<R: Into<C>>(&mut self, R); +	fn children(&mut self) -> &mut Vec<C>; +	fn append_child<R: Into<C>>(&mut self, child: R) { +		self.children().push(child.into()); +	}  }  macro_rules! synonymous_enum {( $name:ident { $( $entry:ident ),* } ) => ( @@ -55,5 +58,5 @@ synonymous_enum!(SubOptionListItem { OptionGroup, Description });  synonymous_enum!(SubOption { OptionString, OptionArgument });  synonymous_enum!(SubLineBlock { LineBlock, Line });  synonymous_enum!(SubBlockQuote { Attribution, BodyElement }); -synonymous_enum!(SubFootnote { Label_, BodyElement }); +synonymous_enum!(SubFootnote { Label, BodyElement });  synonymous_enum!(SubFigure { Image, Caption, Legend, BodyElement }); | 
