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§
Sourcefn description(&self) -> &str
fn description(&self) -> &str
The node’s human-readable description.
Sourcefn config(&self) -> &NodeConfig
fn config(&self) -> &NodeConfig
The node’s configuration.
Sourcefn input_schema(&self) -> Option<&Value>
fn input_schema(&self) -> Option<&Value>
None = no schema, no input validation.
Sourcefn output_schema(&self) -> Option<&Value>
fn output_schema(&self) -> Option<&Value>
None = no schema, no output validation.
Sourcefn validate_input(&self, v: Value) -> Result<Value, WorkflowError>
fn validate_input(&self, v: Value) -> Result<Value, WorkflowError>
Called by the scheduler before run on every activation.
Sourcefn validate_output(&self, v: Value) -> Result<Value, WorkflowError>
fn validate_output(&self, v: Value) -> Result<Value, WorkflowError>
Called by the scheduler on every yielded event with an output.
Sourcefn run(&self, ctx: Context, input: Value) -> EventStream
fn run(&self, ctx: Context, input: Value) -> EventStream
Runs one activation of the node.
Provided Methods§
Sourcefn state_field_names(&self) -> Option<&[String]>
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".