Trait mediawiki_parser::Traversion
source · pub trait Traversion<'a, S: Copy + ?Sized> {
fn path_push(&mut self, elem: &'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 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§
Provided Methods§
sourcefn work(
&mut self,
_root: &'a Element,
_settings: S,
_out: &mut dyn Write
) -> Result<bool>
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.
sourcefn work_vec(
&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>
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.