[][src]Struct siraph::Graph

pub struct Graph { /* fields omitted */ }

The central structure of the crate. The graph manages a bunch of nodes and makes them work together.

Implementations

impl Graph[src]

pub fn new() -> Self[src]

Creates a new empty Graph.

pub fn insert(&mut self, node: impl Node + 'static) -> NodeHandle[src]

Inserts a new node into this graph.

pub fn remove(&mut self, node: NodeHandle) -> Result<()>[src]

Removes a node from the graph. Error::InvalidNodeHandle can be returned if the given NodeHandle was invalid (the node did not exist).

pub fn count(&self) -> usize[src]

Returns the number of nodes that are owned by this graph.

pub fn plug(
    &mut self,
    from_node: NodeHandle,
    from_output: impl Into<Name>,
    to_node: NodeHandle,
    to_input: impl Into<Name>
) -> Result<()>
[src]

Plugs two nodes together.

  • Error::Incompatible is returned if the types of the input and the output are not compatible (they are not the same).
  • Error::Cycle is returned if this new dependency makes a node depend on itself.

pub fn sink<T: 'static>(
    &mut self,
    from_node: NodeHandle,
    from_output: impl Into<Name>
) -> Result<Sink<'_, T>>
[src]

Creates a Sink that allows the caller to retreive data from this Graph.

  • Error::Incompatible is returned if T is not the same type as the type of from_output.

Trait Implementations

impl Default for Graph[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

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

impl<T, U> Into<U> for T where
    U: From<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.