node

Macro node 

Source
macro_rules! node {
    ($input:ty, !$output:ty, $error:ty, $context:ty) => { ... };
    ($input:ty, $output:ty, $error:ty, $context:ty) => { ... };
}
Expand description

A helper macro for declaring impl Node return type.

Use ! before an output type for it to not be wrapped in NodeOutput.

§Parameters

  • $input: The input type accepted by the node.
  • $output: The output type (raw or wrapped) returned by the node.
  • $error: The error type returned by the node.
  • $context: The context type passed to the node.

See also Node, NodeOutput.

§Examples

use node_flow::node::Node;

#[derive(Clone)]
struct ExampleNode;
impl<Context: Send> Node<u8, u64, String, Context> for ExampleNode // ...

fn build_flow<Context: Send>() -> node_flow::node!(u8, !u64, String, Context) {
   ExampleNode
}

§Expansion

node!($input, $output, $error, $context)
// expands to:
impl node_flow::node::Node<
    $input,
    node_flow::node::NodeOutput<$output>,
    $error,
    $context
> + Clone + Send + Sync

By adding ! to output the raw $output type is used:

node!($input, !$output, $error, $context)
// expands to:
impl node_flow::node::Node<$input, $output, $error, $context> + Clone + Send + Sync