[][src]Trait graphity::node::NodeWrapper

pub trait NodeWrapper: NodeClass {
    type Payload: Copy + Default;
    type Consumer: Copy + Hash;
    type Producer: Copy + Hash;
    pub fn tick(&mut self) { ... }
pub fn read<IntoP>(&self, producer: IntoP) -> Self::Payload
    where
        IntoP: Into<Self::Producer>
, { ... }
pub fn write<IntoC>(&mut self, consumer: IntoC, _input: Self::Payload)
    where
        IntoC: Into<Self::Consumer>
, { ... } }

Wrapper around the internal representation of Node.

This type abstracts all the nodes registered by the user. Its main significance is that it is being returned from the graph when looking up nodes. Read the Node documentation to learn about its usage.

Example

let node_index = graph.add_node(Generator(1));
let node_wrapper = graph.node(&node_index).unwrap();
let data = node_wrapper.read(GeneratorProducer);

Associated Types

Loading content...

Provided methods

pub fn tick(&mut self)[src]

pub fn read<IntoP>(&self, producer: IntoP) -> Self::Payload where
    IntoP: Into<Self::Producer>, 
[src]

Read data from the given producer.

Panics

In case the given producer does not belong to this node type, this will panic.

pub fn write<IntoC>(&mut self, consumer: IntoC, _input: Self::Payload) where
    IntoC: Into<Self::Consumer>, 
[src]

Write data into the given consumer.

Panics

In case the given consumer does not belong to this node type, this will panic.

Loading content...

Implementors

Loading content...