Traversion

Trait Traversion 

Source
pub trait Traversion<'a, S: Copy + ?Sized> {
    // Required methods
    fn path_push(&mut self, elem: &'a Element);
    fn path_pop(&mut self) -> Option<&'a Element>;
    fn get_path(&self) -> &Vec<&'a Element>;

    // Provided methods
    fn work(
        &mut self,
        _root: &'a Element,
        _settings: S,
        _out: &mut dyn Write,
    ) -> Result<bool> { ... }
    fn work_vec(
        &mut self,
        _root: &'a [Element],
        _settings: S,
        _out: &mut dyn Write,
    ) -> Result<bool> { ... }
    fn run_vec(
        &mut self,
        content: &'a [Element],
        settings: S,
        out: &mut dyn Write,
    ) -> Result<()> { ... }
    fn run(
        &mut self,
        root: &'a Element,
        settings: S,
        out: &mut dyn Write,
    ) -> Result<()> { ... }
}
Expand description

Implements a traversion over a tree of Element.

All fields of the traversion struct can be mutated, external settings cannot.

Required Methods§

Source

fn path_push(&mut self, elem: &'a Element)

push to the traversion path.

Source

fn path_pop(&mut self) -> Option<&'a Element>

pop from the traversion path.

Source

fn get_path(&self) -> &Vec<&'a Element>

get the traversion path.

Provided Methods§

Source

fn work( &mut self, _root: &'a Element, _settings: S, _out: &mut dyn Write, ) -> Result<bool>

template method for handling single nodes. if the result is false, handling is complete and children of this node are not considered, otherwise work() is recursively called for all children.

Source

fn work_vec( &mut self, _root: &'a [Element], _settings: S, _out: &mut dyn Write, ) -> Result<bool>

template method for handling a vector of nodes. if the result is false, handling is complete and children of the vector’s elements are not considered, otherwise work() is recursively called for all children.

Source

fn run_vec( &mut self, content: &'a [Element], settings: S, out: &mut dyn Write, ) -> Result<()>

run this traversion for a vector of elements.

Source

fn run( &mut self, root: &'a Element, settings: S, out: &mut dyn Write, ) -> Result<()>

run this traversion for an element.

Implementors§