[−][src]Struct daggy::Children
pub struct Children<N, E, Ix: IndexType> { /* fields omitted */ }
A Walker type that can be used to step through the children of some parent node.
Trait Implementations
impl<N, E, Ix> Walker<Dag<N, E, Ix>> for Children<N, E, Ix> where
Ix: IndexType,
[src][+]
Ix: IndexType,
type Index = Ix
The unsigned integer type used for node and edge indices.
fn next(
&mut self,
dag: &Dag<N, E, Ix>
) -> Option<(EdgeIndex<Ix>, NodeIndex<Ix>)>
[src][−]
&mut self,
dag: &Dag<N, E, Ix>
) -> Option<(EdgeIndex<Ix>, NodeIndex<Ix>)>
Fetch the EdgeIndex
and NodeIndex
to the next neighbour in our walk through the given
Graph. Read more
fn next_edge(&mut self, graph: &G) -> Option<EdgeIndex<Self::Index>>
[src][−]
The next edge in our walk for the given Graph.
fn next_node(&mut self, graph: &G) -> Option<NodeIndex<Self::Index>>
[src][−]
The next node in our walk for the given Graph.
fn count(self, graph: &G) -> usize where
Self: Sized,
[src][−]
Self: Sized,
Counts all the steps in the entire walk of the given graph.
fn last(self, graph: &G) -> Option<IndexPair<Self::Index>> where
Self: Sized,
[src][−]
Self: Sized,
Walks the whole walk until reaching and returning the last edge node pair.
fn last_edge(self, graph: &G) -> Option<EdgeIndex<Self::Index>> where
Self: Sized,
[src][−]
Self: Sized,
Walks the whole walk until reaching and returning the last edge.
fn last_node(self, graph: &G) -> Option<NodeIndex<Self::Index>> where
Self: Sized,
[src][−]
Self: Sized,
Walks the whole walk until reaching and returning the last node.
fn nth(self, graph: &G, n: usize) -> Option<IndexPair<Self::Index>> where
Self: Sized,
[src][−]
Self: Sized,
Walks "n" number of steps and produces the resulting edge node pair.
fn nth_edge(self, graph: &G, n: usize) -> Option<EdgeIndex<Self::Index>> where
Self: Sized,
[src][−]
Self: Sized,
Walks "n" number of steps and produces the resulting edge.
fn nth_node(self, graph: &G, n: usize) -> Option<NodeIndex<Self::Index>> where
Self: Sized,
[src][−]
Self: Sized,
Walks "n" number of steps and produces the resulting node.
fn chain<O>(self, other: O) -> Chain<G, Self::Index, Self, O> where
Self: Sized,
O: Walker<G, Index = Self::Index>,
[src][−]
Self: Sized,
O: Walker<G, Index = Self::Index>,
Produces a walker that will walk the entirey of self
before walking the entirey of other.
fn filter<P>(self, predicate: P) -> Filter<Self, P> where
Self: Sized,
P: FnMut(&G, EdgeIndex<Self::Index>, NodeIndex<Self::Index>) -> bool,
[src][−]
Self: Sized,
P: FnMut(&G, EdgeIndex<Self::Index>, NodeIndex<Self::Index>) -> bool,
Creates a walker that applies the predicate to each element returned by this walker. The only elements that will be yielded are those that make the predicate evaluate to true. Read more
fn peekable(self) -> Peekable<G, Self::Index, Self> where
Self: Sized,
[src][−]
Self: Sized,
Creates a walker that has a .peek(&graph)
method that returns an optional next neighbor.
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P> where
Self: Sized,
P: FnMut(&G, EdgeIndex<Self::Index>, NodeIndex<Self::Index>) -> bool,
[src][−]
Self: Sized,
P: FnMut(&G, EdgeIndex<Self::Index>, NodeIndex<Self::Index>) -> bool,
Creates a walker that invokes the predicate on elements until it returns false. Once the predicate returns false, that element and all further elements are yielded. Read more
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P> where
Self: Sized,
P: FnMut(&G, EdgeIndex<Self::Index>, NodeIndex<Self::Index>) -> bool,
[src][−]
Self: Sized,
P: FnMut(&G, EdgeIndex<Self::Index>, NodeIndex<Self::Index>) -> bool,
Creates a walker that yields elements so long as the predicate returns true. After the predicate returns false for the first time, no further elements will be yielded. Read more
fn skip(self, n: usize) -> Skip<G, Self::Index, Self> where
Self: Sized,
[src][−]
Self: Sized,
Creates a walker that skips the first n steps of this walk, and then yields all further steps. Read more
fn take(self, n: usize) -> Take<G, Self::Index, Self> where
Self: Sized,
[src][−]
Self: Sized,
Creates a walker that yields the first n steps of this walk.
fn all<P>(&mut self, graph: &G, predicate: P) -> bool where
P: FnMut(&G, EdgeIndex<Self::Index>, NodeIndex<Self::Index>) -> bool,
[src][−]
P: FnMut(&G, EdgeIndex<Self::Index>, NodeIndex<Self::Index>) -> bool,
Tests whether the predicate holds true for all steps in the walk.
fn any<P>(&mut self, graph: &G, predicate: P) -> bool where
P: FnMut(&G, EdgeIndex<Self::Index>, NodeIndex<Self::Index>) -> bool,
[src][−]
P: FnMut(&G, EdgeIndex<Self::Index>, NodeIndex<Self::Index>) -> bool,
Tests whether any step in the walk satisfies the given predicate. Read more
fn find<P>(&mut self, graph: &G, predicate: P) -> Option<IndexPair<Self::Index>> where
P: FnMut(&G, EdgeIndex<Self::Index>, NodeIndex<Self::Index>) -> bool,
[src][−]
P: FnMut(&G, EdgeIndex<Self::Index>, NodeIndex<Self::Index>) -> bool,
Returns the first edge node index pair satisfying the specified predicate. Read more
fn find_edge<P>(
&mut self,
graph: &G,
predicate: P
) -> Option<EdgeIndex<Self::Index>> where
P: FnMut(&G, EdgeIndex<Self::Index>, NodeIndex<Self::Index>) -> bool,
[src][−]
&mut self,
graph: &G,
predicate: P
) -> Option<EdgeIndex<Self::Index>> where
P: FnMut(&G, EdgeIndex<Self::Index>, NodeIndex<Self::Index>) -> bool,
Returns the edge index satisfying the specified predicate. Read more
fn find_node<P>(
&mut self,
graph: &G,
predicate: P
) -> Option<NodeIndex<Self::Index>> where
P: FnMut(&G, EdgeIndex<Self::Index>, NodeIndex<Self::Index>) -> bool,
[src][−]
&mut self,
graph: &G,
predicate: P
) -> Option<NodeIndex<Self::Index>> where
P: FnMut(&G, EdgeIndex<Self::Index>, NodeIndex<Self::Index>) -> bool,
Returns the node index satisfying the specified predicate. Read more
fn cycle(self) -> Cycle<G, Self::Index, Self> where
Self: Clone + Sized,
[src][−]
Self: Clone + Sized,
Repeats the walker endlessly.
fn fold<B, F>(self, init: B, graph: &G, f: F) -> B where
Self: Sized,
F: FnMut(B, &G, EdgeIndex<Self::Index>, NodeIndex<Self::Index>) -> B,
[src][−]
Self: Sized,
F: FnMut(B, &G, EdgeIndex<Self::Index>, NodeIndex<Self::Index>) -> B,
Performs a fold operation over the entire walker, returning the eventual state at the end of the walk. Read more
fn inspect<F>(self, f: F) -> Inspect<Self, F> where
Self: Sized,
F: FnMut(&G, EdgeIndex<Self::Index>, NodeIndex<Self::Index>),
[src][−]
Self: Sized,
F: FnMut(&G, EdgeIndex<Self::Index>, NodeIndex<Self::Index>),
Creates a walker that calls a function with a reference to each index pair before yielding them. This is often useful for debugging a walker pipeline. Read more
fn iter(self, graph: &G) -> Iter<'_, G, Self::Index, Self>ⓘ where
Self: Sized,
[src][−]
Self: Sized,
Converts the walker into an iterator yielding index pairs. Read more
fn iter_weights(self, graph: &G) -> IterWeights<'_, G, Self::Index, Self>ⓘ where
Self: Sized,
[src][−]
Self: Sized,
Converts the walker into an iterator yielding (&e, &n)
, where e
is the edge weight for
the next EdgeIndex
and n
is the node weight for the next NodeIndex
. Read more
Auto Trait Implementations
impl<N, E, Ix> RefUnwindSafe for Children<N, E, Ix> where
E: RefUnwindSafe,
Ix: RefUnwindSafe,
N: RefUnwindSafe,
E: RefUnwindSafe,
Ix: RefUnwindSafe,
N: RefUnwindSafe,
impl<N, E, Ix> Send for Children<N, E, Ix> where
E: Send,
Ix: Send,
N: Send,
E: Send,
Ix: Send,
N: Send,
impl<N, E, Ix> Sync for Children<N, E, Ix> where
E: Sync,
Ix: Sync,
N: Sync,
E: Sync,
Ix: Sync,
N: Sync,
impl<N, E, Ix> Unpin for Children<N, E, Ix> where
E: Unpin,
Ix: Unpin,
N: Unpin,
E: Unpin,
Ix: Unpin,
N: Unpin,
impl<N, E, Ix> UnwindSafe for Children<N, E, Ix> where
E: UnwindSafe,
Ix: UnwindSafe,
N: UnwindSafe,
E: UnwindSafe,
Ix: UnwindSafe,
N: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src][+]
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
[src][−]
Gets the TypeId
of self
. Read more
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
fn borrow(&self) -> &T
[src][−]
Immutably borrows from an owned value. Read more
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src][−]
Mutably borrows from an owned value. Read more
impl<T> From<T> for T
[src][+]
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src][−]
Performs the conversion.
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,