Trait EdgeWalker

Source
pub trait EdgeWalker<'graph>: Walker<'graph> {
    // Required method
    fn next(
        &mut self,
        graph: &'graph Self::Graph,
    ) -> Option<<Self::Graph as Graph>::EdgeId>;

    // Provided methods
    fn context<Callback, Context>(
        self,
        predicate: Callback,
    ) -> EdgeContext<'graph, Self, Callback, Context>
       where Callback: Fn(&<Self::Graph as Graph>::EdgeReference<'_>, &Self::Context) -> Context { ... }
    fn filter<Predicate>(
        self,
        predicate: Predicate,
    ) -> EdgeFilter<'graph, Self, Predicate>
       where Predicate: Fn(&<Self::Graph as Graph>::EdgeReference<'_>, &Self::Context) -> bool { ... }
    fn control_flow<Predicate>(
        self,
        predicate: Predicate,
    ) -> EdgeControlFlow<'graph, Self, Predicate>
       where Self: 'graph,
             for<'a> Predicate: Fn(&'a <Self::Graph as Graph>::EdgeReference<'graph>, &mut Self::Context) -> ControlFlow<Option<&'a <Self::Graph as Graph>::EdgeReference<'graph>>, Option<&'a <Self::Graph as Graph>::EdgeReference<'graph>>> { ... }
    fn head(self) -> Endpoints<'graph, Self> { ... }
    fn tail(self) -> Endpoints<'graph, Self> { ... }
    fn take(self, n: usize) -> EdgeTake<'graph, Self> { ... }
    fn reduce<Reducer>(
        self,
        reducer: Reducer,
    ) -> EdgeReduce<'graph, Self, Reducer>
       where Reducer: for<'a> Fn(&'a <Self::Graph as Graph>::EdgeReference<'graph>, &'a <Self::Graph as Graph>::EdgeReference<'graph>, &Self::Context) -> &'a <Self::Graph as Graph>::EdgeReference<'graph>,
             <Self as Walker<'graph>>::Graph: 'graph { ... }
}
Expand description

Trait for walking over edges in a graph.

This trait provides methods for working with edges in a graph, including filtering, limiting, and collecting edges. It also provides methods for accessing the head and tail of an edge.

Implementors of this trait are expected to be able to walk over the edges of a graph, and to provide access to the edge references and the context associated with the edge walker.

Required Methods§

Source

fn next( &mut self, graph: &'graph Self::Graph, ) -> Option<<Self::Graph as Graph>::EdgeId>

Returns the next edge ID in the traversal.

This method advances the walker and returns the ID of the next edge, or None if there are no more edges to traverse.

§Parameters
  • graph: The graph being traversed
§Returns

The ID of the next edge, or None if the traversal is complete

Provided Methods§

Source

fn context<Callback, Context>( self, predicate: Callback, ) -> EdgeContext<'graph, Self, Callback, Context>
where Callback: Fn(&<Self::Graph as Graph>::EdgeReference<'_>, &Self::Context) -> Context,

Source

fn filter<Predicate>( self, predicate: Predicate, ) -> EdgeFilter<'graph, Self, Predicate>
where Predicate: Fn(&<Self::Graph as Graph>::EdgeReference<'_>, &Self::Context) -> bool,

Source

fn control_flow<Predicate>( self, predicate: Predicate, ) -> EdgeControlFlow<'graph, Self, Predicate>
where Self: 'graph, for<'a> Predicate: Fn(&'a <Self::Graph as Graph>::EdgeReference<'graph>, &mut Self::Context) -> ControlFlow<Option<&'a <Self::Graph as Graph>::EdgeReference<'graph>>, Option<&'a <Self::Graph as Graph>::EdgeReference<'graph>>>,

Source

fn head(self) -> Endpoints<'graph, Self>

Source

fn tail(self) -> Endpoints<'graph, Self>

Source

fn take(self, n: usize) -> EdgeTake<'graph, Self>

Source

fn reduce<Reducer>(self, reducer: Reducer) -> EdgeReduce<'graph, Self, Reducer>
where Reducer: for<'a> Fn(&'a <Self::Graph as Graph>::EdgeReference<'graph>, &'a <Self::Graph as Graph>::EdgeReference<'graph>, &Self::Context) -> &'a <Self::Graph as Graph>::EdgeReference<'graph>, <Self as Walker<'graph>>::Graph: 'graph,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§