textlane-core 0.6.1

Textlane's core: unist, mdast, hast and nlcst trees, the file and the plugin contract its crates share
Documentation
use crate::models::{hast, mdast, nlcst};

/// The tree a pipeline stage takes or returns.
#[derive(Debug, PartialEq)]
pub enum Tree<'a> {
    Mdast(mdast::Node<'a>),
    Hast(hast::Node<'a>),
    Nlcst(nlcst::Node<'a>),
}

/// Which kind of tree a stage takes or returns, checked when a processor freezes.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum TreeKind {
    Mdast,
    Hast,
    Nlcst,
}

impl Tree<'_> {
    pub fn kind(&self) -> TreeKind {
        match self {
            Tree::Mdast(_) => TreeKind::Mdast,
            Tree::Hast(_) => TreeKind::Hast,
            Tree::Nlcst(_) => TreeKind::Nlcst,
        }
    }
}