pub trait Visitor {
type Hasher: Hasher;
// Required methods
fn visit<N>(&mut self, node: &N) -> bool
where N: Identifiable;
fn clear(&mut self);
fn hasher(&self) -> Self::Hasher;
// Provided methods
fn touch<N>(&mut self, _node: &N)
where N: Identifiable { ... }
fn leave<N>(&mut self, _node: &N)
where N: Identifiable { ... }
}
Expand description
A collection passed in to a graph, tracking the identifiers of each nodes to avoid traversing
Required Associated Types§
Required Methods§
sourcefn visit<N>(&mut self, node: &N) -> boolwhere
N: Identifiable,
fn visit<N>(&mut self, node: &N) -> boolwhere N: Identifiable,
Return true iff this node hasn’t been visited yet.
sourcefn clear(&mut self)
fn clear(&mut self)
Clear the internal collection, prompting this visitor to revisit all nodes on the next traversal.
fn hasher(&self) -> Self::Hasher
Provided Methods§
sourcefn touch<N>(&mut self, _node: &N)where
N: Identifiable,
fn touch<N>(&mut self, _node: &N)where N: Identifiable,
Touch the node. Useful for building graph visualisations.
sourcefn leave<N>(&mut self, _node: &N)where
N: Identifiable,
fn leave<N>(&mut self, _node: &N)where N: Identifiable,
Undo a touch. Useful for building graph visualisations.
Implementations on Foreign Types§
source§impl Visitor for HashSet<usize, BuildHasherDefault<AHasher>, Global>
impl Visitor for HashSet<usize, BuildHasherDefault<AHasher>, Global>
Implementors§
source§impl Visitor for GraphvizVisitor
Available on crate feature graphviz
only.
impl Visitor for GraphvizVisitor
Available on crate feature
graphviz
only.