IVisit

Trait IVisit 

Source
pub trait IVisit {
    // Required method
    fn visit(&mut self, f: &mut dyn FnMut(&mut dyn INode));
}
Expand description

Node visitor.

The visitor pattern is used to discover child nodes in custom types.

This trait is most commonly required to be implemented by users of this crate.

struct Foo {
	data: i32,
}

impl cvar::IVisit for Foo {
	fn visit(&mut self, f: &mut dyn FnMut(&mut dyn cvar::INode)) {
		// Pass type-erased properties, lists and actions to the closure
		f(&mut cvar::Property("data", &mut self.data, &42));
	}
}

Required Methods§

Source

fn visit(&mut self, f: &mut dyn FnMut(&mut dyn INode))

Visits the child nodes.

Callers may depend on the particular order in which the nodes are passed to the closure.

Trait Implementations§

Source§

impl Debug for dyn IVisit + '_

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Implementors§

Source§

impl<F: FnMut(&mut dyn FnMut(&mut dyn INode))> IVisit for Visit<F>