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<G, W, P> Walker<G> for SkipWhile<G, W, P>where G: GraphRef, W: Walker<G>, P: FnMut(G, &<W as Walker<G>>::Item) -> bool,

§

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

source§

fn walk_next( &mut self, graph: G ) -> Option<<SkipWhile<G, W, P> as Walker<G>>::Item>

source§

impl<'a, N, E, Ix> Walker<&'a Dag<N, E, Ix>> for Children<N, E, Ix>where Ix: IndexType,

§

type Item = (EdgeIndex<Ix>, NodeIndex<Ix>)

source§

fn walk_next( &mut self, dag: &'a Dag<N, E, Ix> ) -> Option<<Children<N, E, Ix> as Walker<&'a Dag<N, E, Ix>>>::Item>

source§

impl<G, W, F> Walker<G> for Inspect<W, F>where G: GraphRef, W: Walker<G>, F: FnMut(G, &<W as Walker<G>>::Item),

§

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

source§

fn walk_next(&mut self, graph: G) -> Option<<W as Walker<G>>::Item>

source§

impl<G, W, P> Walker<G> for TakeWhile<G, W, P>where G: GraphRef, W: Walker<G>, P: FnMut(G, &<W as Walker<G>>::Item) -> bool,

§

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

source§

fn walk_next( &mut self, graph: G ) -> Option<<TakeWhile<G, W, P> as Walker<G>>::Item>

source§

impl<G, W, P> Walker<G> for Filter<G, W, P>where G: GraphRef, W: Walker<G>, P: FnMut(G, &<W as Walker<G>>::Item) -> bool,

§

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

source§

fn walk_next( &mut self, graph: G ) -> Option<<Filter<G, W, P> as Walker<G>>::Item>

source§

impl<'a, N, E, Ix> Walker<&'a Dag<N, E, Ix>> for Parents<N, E, Ix>where Ix: IndexType,

§

type Item = (EdgeIndex<Ix>, NodeIndex<Ix>)

source§

fn walk_next( &mut self, dag: &'a Dag<N, E, Ix> ) -> Option<<Parents<N, E, Ix> as Walker<&'a Dag<N, E, Ix>>>::Item>

source§

impl<G, W> Walker<G> for Cycle<G, W>where G: GraphRef, W: Walker<G> + Clone,

§

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

source§

fn walk_next(&mut self, graph: G) -> Option<<Cycle<G, W> as Walker<G>>::Item>

source§

impl<G, W> Walker<G> for Peekable<G, W>where G: GraphRef, W: Walker<G>,

§

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

source§

fn walk_next(&mut self, graph: G) -> Option<<Peekable<G, W> as Walker<G>>::Item>

source§

impl<G, W> Walker<G> for Skip<G, W>where G: GraphRef, W: Walker<G>,

§

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

source§

fn walk_next(&mut self, graph: G) -> Option<<Skip<G, W> as Walker<G>>::Item>

source§

impl<'a, G, F> Walker<&'a G> for Recursive<G, F>where G: GraphBase, F: FnMut(&G, <G as GraphBase>::NodeId) -> Option<(<G as GraphBase>::EdgeId, <G as GraphBase>::NodeId)>,

§

type Item = (<G as GraphBase>::EdgeId, <G as GraphBase>::NodeId)

source§

fn walk_next( &mut self, g: &G ) -> Option<<Recursive<G, F> as Walker<&'a G>>::Item>

source§

impl<'a, G, A, B> Walker<&'a G> for Chain<G, A, B>where G: GraphBase, A: Walker<&'a G>, B: Walker<&'a G, Item = <A as Walker<&'a G>>::Item>,

§

type Item = <A as Walker<&'a G>>::Item

source§

fn walk_next( &mut self, graph: &'a G ) -> Option<<Chain<G, A, B> as Walker<&'a G>>::Item>

source§

impl<G, W> Walker<G> for Take<G, W>where G: GraphRef, W: Walker<G>,

§

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

source§

fn walk_next(&mut self, graph: G) -> Option<<Take<G, W> as Walker<G>>::Item>

Implementors§

source§

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

§

type Item = <G as GraphBase>::NodeId

source§

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

§

type Item = <G as GraphBase>::NodeId

source§

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

§

type Item = <G as GraphBase>::NodeId

source§

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

§

type Item = <G as GraphBase>::NodeId