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§
Sourcefn input_pins(&self) -> Vec<InputPin>
fn input_pins(&self) -> Vec<InputPin>
Returns the input pins for this specific node instance.
Sourcefn output_pins(&self) -> Vec<OutputPin>
fn output_pins(&self) -> Vec<OutputPin>
Returns the output pins for this specific node instance.
Provided Methods§
Sourcefn content_type(&self) -> Option<String>
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.
Sourcefn 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 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(),
})
}Sourcefn supports_dynamic_pins(&self) -> bool
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).