Skip to main content

Node

Trait Node 

Source
pub trait Node:
    Send
    + Sync
    + 'static {
    // Required methods
    fn name(&self) -> &str;
    fn description(&self) -> &str;
    fn config(&self) -> &NodeConfig;
    fn input_schema(&self) -> Option<&Value>;
    fn output_schema(&self) -> Option<&Value>;
    fn validate_input(&self, v: Value) -> Result<Value, WorkflowError>;
    fn validate_output(&self, v: Value) -> Result<Value, WorkflowError>;
    fn run(&self, ctx: Context, input: Value) -> EventStream;
    fn as_any(&self) -> &dyn Any;

    // Provided method
    fn state_field_names(&self) -> Option<&[String]> { ... }
}
Expand description

A node of a workflow graph. Inputs and outputs are serde_json::Value; “no value” is Value::Null.

Required Methods§

Source

fn name(&self) -> &str

The node’s name, unique within a workflow graph.

Source

fn description(&self) -> &str

The node’s human-readable description.

Source

fn config(&self) -> &NodeConfig

The node’s configuration.

Source

fn input_schema(&self) -> Option<&Value>

None = no schema, no input validation.

Source

fn output_schema(&self) -> Option<&Value>

None = no schema, no output validation.

Source

fn validate_input(&self, v: Value) -> Result<Value, WorkflowError>

Called by the scheduler before run on every activation.

Source

fn validate_output(&self, v: Value) -> Result<Value, WorkflowError>

Called by the scheduler on every yielded event with an output.

Source

fn run(&self, ctx: Context, input: Value) -> EventStream

Runs one activation of the node.

Source

fn as_any(&self) -> &dyn Any

Downcasting support, to tell concrete node types apart.

Provided Methods§

Source

fn state_field_names(&self) -> Option<&[String]>

The names of the state fields the node binds as parameters; None = node does not bind state params.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§