Skip to main content

auto_node

Attribute Macro auto_node 

Source
#[auto_node]
Expand description

[auto_node] is a macro that may be used when customizing nodes. It can only be marked on named struct or unit struct.

The macro [auto_node] generates essential fields and implementation of traits for structs intended to represent Node in Dagrs. By applying this macro to a struct, it appends fields including id: dagrs::NodeId, name: dagrs::NodeName, input_channels: dagrs::InChannels, output_channels: dagrs::OutChannels, and action: dagrs::Action, and implements the required dagrs::Node trait.

ยงExample

  • Mark auto_node on a struct with customized fields.
โ“˜
use dagrs::auto_node;
#[auto_node]
struct MyNode {/*Put your customized fields here.*/}
  • Mark auto_node on a struct with generic & lifetime params.
โ“˜
use dagrs::auto_node;
#[auto_node]
struct MyNode<T, 'a> {/*Put your customized fields here.*/}
  • Mark auto_node on a unit struct.
โ“˜
use dagrs::auto_node;
#[auto_node]
struct MyNode()