(home)

Igneous Linearizer snippets

impl fmt::Display for Hyperstring {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        for segment in &self.0 {
            write!(f, "{}", segment)?;
        }
        Ok(())
    }
}

impl fmt::Display for HyperstringSegment {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        match self {
            HyperstringSegment::Text(text) => write!(f, "{}", text),
            HyperstringSegment::Link(link) => write!(f, "\u{005B}\u{005B}{}]]", link),
            HyperstringSegment::Transclusion(transclusion) => {
                write!(f, "!\u{005B}\u{005B}{}]]", transclusion)
            }
        }
    }
}

Backlinks