impl Hyperstring { pub fn to_plaintext(&self, page_map: &HashMap<String, Page>) -> String { self.0 .iter() .map(|segment| match segment { HyperstringSegment::Text(text) => text.clone(), HyperstringSegment::Link(link) => link_title_or_name(page_map, link), HyperstringSegment::Transclusion(transclusion) => { let transclusion_page = page_map.get(transclusion).unwrap(); transclusion_page.hyperstring.to_plaintext(page_map) } }) .collect::<Vec<_>>() .concat() } }