ProcessorNode

Trait ProcessorNode 

Source
pub trait ProcessorNode: Send + Sync {
    // Required methods
    fn input_pins(&self) -> Vec<InputPin>;
    fn output_pins(&self) -> Vec<OutputPin>;
    fn run<'async_trait>(
        self: Box<Self>,
        context: NodeContext,
    ) -> Pin<Box<dyn Future<Output = Result<(), StreamKitError>> + Send + 'async_trait>>
       where Self: 'async_trait;

    // Provided methods
    fn content_type(&self) -> Option<String> { ... }
    fn initialize<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        _ctx: &'life1 InitContext,
    ) -> Pin<Box<dyn Future<Output = Result<PinUpdate, StreamKitError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn supports_dynamic_pins(&self) -> bool { ... }
}
Expand description

The fundamental trait for any processing node, designed as an actor.

Required Methods§

Source

fn input_pins(&self) -> Vec<InputPin>

Returns the input pins for this specific node instance.

Source

fn output_pins(&self) -> Vec<OutputPin>

Returns the output pins for this specific node instance.

Source

fn run<'async_trait>( self: Box<Self>, context: NodeContext, ) -> Pin<Box<dyn Future<Output = Result<(), StreamKitError>> + Send + 'async_trait>>
where Self: 'async_trait,

The main actor loop for the node. The engine will spawn this method as a task.

Provided Methods§

Source

fn content_type(&self) -> Option<String>

For nodes that produce a final, self-contained file format, this method should return the appropriate MIME type string.

Source

fn initialize<'life0, 'life1, 'async_trait>( &'life0 mut self, _ctx: &'life1 InitContext, ) -> Pin<Box<dyn Future<Output = Result<PinUpdate, StreamKitError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Tier 1: Initialization-time discovery.

Called after instantiation but before pipeline execution. Allows nodes to probe external resources and finalize pin definitions.

Default implementation does nothing (static pins).

§Example
async fn initialize(&mut self, ctx: &InitContext) -> Result<PinUpdate, StreamKitError> {
    // Probe external resource
    let tracks = probe_broadcast(&self.url).await?;

    // Update pins based on discovery
    self.tracks = tracks;
    Ok(PinUpdate::Updated {
        inputs: self.input_pins(),
        outputs: self.output_pins(),
    })
}
Source

fn supports_dynamic_pins(&self) -> bool

Tier 2: Runtime pin management capability.

Returns true if this node supports adding/removing pins while running. Nodes that return true must handle PinManagementMessage messages.

Default implementation returns false (static pins after init).

Implementors§