aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Schaf2015-11-14 22:18:58 +0100
committerPhil Schaf2015-11-14 22:18:58 +0100
commit11d453f354c3bfd8f2c2f755c0246f3c2f526179 (patch)
tree3cada607217cb784751e0252cb7e9a00b5bc3e29
parentd3c3b98b43713a66111994c81bbf5c12776ad39f (diff)
downloadrust-rst-11d453f354c3bfd8f2c2f755c0246f3c2f526179.tar.bz2
added a append_children function
-rw-r--r--src/document_tree/element_categories.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/document_tree/element_categories.rs b/src/document_tree/element_categories.rs
index 17bc01a..d8024ad 100644
--- a/src/document_tree/element_categories.rs
+++ b/src/document_tree/element_categories.rs
@@ -6,6 +6,13 @@ pub trait HasChildren<C> {
fn append_child<R: Into<C>>(&mut self, child: R) {
self.children_mut().push(child.into());
}
+ fn append_children<R: Into<C> + Clone>(&mut self, more: &[R]) {
+ let mut children = self.children_mut();
+ children.reserve(more.len());
+ for child in more {
+ children.push(child.clone().into());
+ }
+ }
}
macro_rules! synonymous_enum {( $name:ident { $( $entry:ident ),* } ) => (