[−][src]Struct siraph::Graph
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]
&mut self,
from_node: NodeHandle,
from_output: impl Into<Name>,
to_node: NodeHandle,
to_input: impl Into<Name>
) -> Result<()>
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]
&mut self,
from_node: NodeHandle,
from_output: impl Into<Name>
) -> Result<Sink<'_, T>>
Creates a Sink
that allows the caller to retreive data from this Graph
.
Error::Incompatible
is returned ifT
is not the same type as the type offrom_output
.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Graph
[src]
impl !Send for Graph
[src]
impl !Sync for Graph
[src]
impl Unpin for Graph
[src]
impl !UnwindSafe for Graph
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
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.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,