Skip to content

Instantly share code, notes, and snippets.

@bartolsthoorn
Created August 29, 2014 20:35
Show Gist options
  • Save bartolsthoorn/db519f113d6e8afe7af4 to your computer and use it in GitHub Desktop.
Save bartolsthoorn/db519f113d6e8afe7af4 to your computer and use it in GitHub Desktop.
enum Node {
Text(String),
Element(String, Vec<Node>)
}
impl Node {
fn stringify(&self) -> String {
match *self {
Text(s) => s,
Element(name, nodes) =>
"<".to_string() + name + ">".to_string() +
nodes.iter().map(|node| node.stringify()).concat() +
"</".to_string() + name + ">".to_string()
}
}
}
@bartolsthoorn
Copy link
Author

error: type core::iter::Map<'_,&Node,collections::string::String,core::slice::Items<'_,Node>> does not implement any method in scope named concat

nodes.iter().map(|node| node.stringify()).concat()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment