[][src]Struct elba::util::graph::Graph

pub struct Graph<T, E = ()> where
    T: Eq
{ pub inner: Graph<T, E>, }

A wrapper for petgraph::Graph.

This graph is a directed acyclic graph; we always assume that the root node is at node index 0.

Fields

inner: Graph<T, E>

Methods

impl<T: Eq, E> Graph<T, E>[src]

pub fn new(graph: Graph<T, E>) -> Self[src]

pub fn find_id(&self, node: &T) -> Option<NodeIndex>[src]

pub fn find_by<F>(&self, f: F) -> Option<&T> where
    F: Fn(&T) -> bool
[src]

pub fn sub_tree<'a>(
    &'a self,
    root_id: NodeIndex
) -> impl Iterator<Item = (NodeIndex, &T)> + 'a
[src]

Recursively traverse the entire sub tree of the given root, including the root itself

pub fn children<'a>(
    &'a self,
    parent_id: NodeIndex
) -> impl Iterator<Item = (NodeIndex, &T)> + 'a
[src]

Traverse all direct children of the given node

pub fn parents<'a>(
    &'a self,
    child_id: NodeIndex
) -> impl Iterator<Item = (NodeIndex, &T)> + 'a
[src]

Traverse all direct parents of the given node

pub fn map<U, V, F, G>(&self, f: F, g: G) -> Res<Graph<U, V>> where
    U: Eq,
    F: FnMut(NodeIndex, &T) -> Res<U>,
    G: FnMut(&E) -> Res<V>, 
[src]

pub fn filter_map<U, V, F, G>(&mut self, f: F, g: G) -> Graph<U, V> where
    U: Eq,
    F: FnMut(&T) -> Option<U>,
    G: FnMut(&E) -> Option<V>, 
[src]

Trait Implementations

impl Into<LockfileToml> for Graph<Summary>[src]

impl<T: Clone, E: Clone> Clone for Graph<T, E> where
    T: Eq
[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl From<LockfileToml> for Graph<Summary>[src]

impl<T> Default for Graph<T> where
    T: Eq
[src]

impl<T: Debug, E: Debug> Debug for Graph<T, E> where
    T: Eq
[src]

impl<T, E> Index<NodeIndex<u32>> for Graph<T, E> where
    T: Eq
[src]

type Output = T

The returned type after indexing.

impl<T, E> IndexMut<NodeIndex<u32>> for Graph<T, E> where
    T: Eq
[src]

Auto Trait Implementations

impl<T, E> Send for Graph<T, E> where
    E: Send,
    T: Send

impl<T, E> Sync for Graph<T, E> where
    E: Sync,
    T: Sync

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T

impl<T> SendSyncUnwindSafe for T where
    T: Send + Sync + UnwindSafe + ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Err = <U as TryFrom<T>>::Err

impl<T> Same<T> for T

type Output = T

Should always be Self