Skip to main content

DataflowNode

Trait DataflowNode 

Source
pub trait DataflowNode: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn input_ports(&self) -> Vec<PortIndex> ⓘ;
    fn output_ports(&self) -> Vec<PortIndex> ⓘ;
    fn execute<'life0, 'life1, 'async_trait>(
        &'life0 self,
        node_id: NodeId,
        inputs: IndexMap<PortIndex, BspValue>,
        ctx: &'life1 BspContext,
    ) -> Pin<Box<dyn Future<Output = Result<IndexMap<PortIndex, BspValue>, BspError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn is_dynamic_output(&self) -> bool { ... }
}
Expand description

The dataflow-profile authoring trait: plain-Rust node authoring without macros.

The #[node] / #[node_blocking] macros generate this same shape under the hood; implement DataflowNode directly when you want the classic (node_id, inputs, ctx) -> outputs signature with no macro magic — e.g. when a registry or GUI bridge (like the snarl one) constructs nodes from descriptors.

Every DataflowNode automatically implements BspNode over any consumer state S, with join semantics (Activation::All) and outputs packed into NodeOutcome::Success. The two authoring styles compose freely in one graph.

Note: implement either DataflowNode or BspNode for a type, never both — the blanket impl would collide.

Required Methods§

Source

fn name(&self) -> &str

Semantic name used for logs, interceptors, and the GUI.

Source

fn input_ports(&self) -> Vec<PortIndex> ⓘ

The unique indices of input ports required for execution.

Source

fn output_ports(&self) -> Vec<PortIndex> ⓘ

The unique indices of output ports produced upon success.

Source

fn execute<'life0, 'life1, 'async_trait>( &'life0 self, node_id: NodeId, inputs: IndexMap<PortIndex, BspValue>, ctx: &'life1 BspContext, ) -> Pin<Box<dyn Future<Output = Result<IndexMap<PortIndex, BspValue>, BspError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Core computation over the gathered pin inputs.

Provided Methods§

Source

fn is_dynamic_output(&self) -> bool

Indicates whether output ports are evaluated dynamically at runtime.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§