After a few hints on IRC I managed to simplify it to:
fn collect_node_names(&self, map: &mut HashMap>,
nodes: &Vec>) -> bool {
for n in nodes.iter() {
if !self.collect_node_names(map, &n.subnodes) {
return false;
}
match n.name {
Some(ref name) => {
if map.co
I have a tree of Nodes where each node might have a name. I'm trying to
convert the tree into a HashMap of named nodes, but my code is getting
extremely complex due to the fact that I cannot pass &mut HashMap around.
let mut named_nodes = HashMap::new();
let nodes = vec!( ... );
named_nodes = self