[][src]Crate dager


Dager is the second (or third) attempt at creating an easy to use, graph execution library. The biggest advancment over dagxecutor is its shorter name... and the ability to define default values for inputs of nodes.


Aggregators and Nodes

As an user you'll usually only have to implement the Node trait to have new node types. A node can then be wrapped into an Aggregator. The aggregator handles the waiting for all required data, execution of your node and sending of the processed data to other connected nodes.

Implementing a node

A node has three mandatory parts.

  1. an input signature
  2. an output signature
  3. a process function that takes an input signature and outputs the output signature

The signatures should always be defined as tuples (excluding a single value which is [T;1], check the note on why that is in the signature mod). On that node, implementing add for f32 would look like this:

use dager::Node;
struct Add;
impl Node for Add{
    type InSig = (f32, f32);
    type OutSig = [f32;1];
    fn process(&mut self, input: Self::InSig) -> Self::OutSig{
        [input.0 + input.1]

Graphs and execution

A graph is defined by some AbstAggregators that are connected via Edges. One or several Executors can be used to set Inputs of those aggregators. If an aggregator has all its inputs set, either by the inner nodes default() implementations or in some other way, the node within this aggregator is executed. The result is then send to connected aggregators. Have a look at examples/math.rs for some small example.


pub use executor::Executor;
pub use node::arc_node;
pub use node::Node;
pub use node::AbstAggregator;
pub use node::Aggregator;
pub use node::Executable;
pub use edge::Edge;



Contains definitions of data collection for in and output ports


Defines how edges are set between nodes


Small thread pool based executor that is used when scheduling new threads from within a node.


Contains the description of input ports as well as the implementations of them for several tubel.


Defines the interface a node must provide to work with this graph.


Contains the description of output ports as well as the implementation of them for several tubel.


Contains IoSignature related implementations as well as the main trait that need to be implemented for all of them.



Implemets the InSignature trait for any tupel of the for (A, B, C, ...) denoted as impl_insig!(A:0, B:1, C:2, ...);


Implemets the IntoIoSignature trait for any tupel of the for (A, B, C, ...) denoted as impl_io!(A:0, B:1, C:2, ...);


Implemets the OutSignature trait for any tupel of the for (A, B, C, ...) denoted as impl_outsig!(A:0, B:1, C:2, ...);



All runtime errors that can occure while executing or manipulating some graph.