Trait mediawiki_parser::Traversion [−][src]
pub trait Traversion<'a, S: Copy + ?Sized> { fn path_push(&mut self, _: &'a Element); fn path_pop(&mut self) -> Option<&'a Element>; fn get_path(&self) -> &Vec<&'a Element>; fn work(
&mut self,
_root: &'a Element,
_settings: S,
_out: &mut Write
) -> Result<bool> { ... } fn work_vec(
&mut self,
_root: &'a [Element],
_settings: S,
_out: &mut Write
) -> Result<bool> { ... } fn run_vec(
&mut self,
content: &'a [Element],
settings: S,
out: &mut Write
) -> Result<()> { ... } fn run(
&mut self,
root: &'a Element,
settings: S,
out: &mut Write
) -> Result<()> { ... } }
Implements a traversion over a tree of Element
.
All fields of the traversion struct can be mutated, external settings cannot.
Required Methods
fn path_push(&mut self, _: &'a Element)
push to the traversion path.
fn path_pop(&mut self) -> Option<&'a Element>
pop from the traversion path.
fn get_path(&self) -> &Vec<&'a Element>
get the traversion path.
Provided Methods
fn work(
&mut self,
_root: &'a Element,
_settings: S,
_out: &mut Write
) -> Result<bool>
&mut self,
_root: &'a Element,
_settings: S,
_out: &mut 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.
fn work_vec(
&mut self,
_root: &'a [Element],
_settings: S,
_out: &mut Write
) -> Result<bool>
&mut self,
_root: &'a [Element],
_settings: S,
_out: &mut 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.
fn run_vec(
&mut self,
content: &'a [Element],
settings: S,
out: &mut Write
) -> Result<()>
&mut self,
content: &'a [Element],
settings: S,
out: &mut Write
) -> Result<()>
run this traversion for a vector of elements.
fn run(&mut self, root: &'a Element, settings: S, out: &mut Write) -> Result<()>
run this traversion for an element.