pub trait Walker<Context> {
    type Item;

    // Required method
    fn walk_next(&mut self, context: Context) -> Option<Self::Item>;

    // Provided method
    fn iter(self, context: Context) -> WalkerIter<Self, Context> 
       where Self: Sized,
             Context: Clone { ... }
}
Expand description

A walker is a traversal state, but where part of the traversal information is supplied manually to each next call.

This for example allows graph traversals that don’t hold a borrow of the graph they are traversing.

Required Associated Types§

Required Methods§

source

fn walk_next(&mut self, context: Context) -> Option<Self::Item>

Advance to the next item

Provided Methods§

source

fn iter(self, context: Context) -> WalkerIter<Self, Context>
where Self: Sized, Context: Clone,

Create an iterator out of the walker and given context.

Implementations on Foreign Types§

source§

impl<'a, C, W> Walker<C> for &'a mut W
where W: Walker<C> + ?Sized,

§

type Item = <W as Walker<C>>::Item

source§

fn walk_next(&mut self, context: C) -> Option<<&'a mut W as Walker<C>>::Item>

Implementors§

source§

impl<G> Walker<G> for Bfs<<G as GraphBase>::NodeId, <G as Visitable>::Map>

§

type Item = <G as GraphBase>::NodeId

source§

impl<G> Walker<G> for Dfs<<G as GraphBase>::NodeId, <G as Visitable>::Map>

§

type Item = <G as GraphBase>::NodeId

source§

impl<G> Walker<G> for DfsPostOrder<<G as GraphBase>::NodeId, <G as Visitable>::Map>

§

type Item = <G as GraphBase>::NodeId

source§

impl<G> Walker<G> for Topo<<G as GraphBase>::NodeId, <G as Visitable>::Map>

§

type Item = <G as GraphBase>::NodeId