NativeProcessorNode

Trait NativeProcessorNode 

Source
pub trait NativeProcessorNode:
    Sized
    + Send
    + 'static {
    // Required methods
    fn metadata() -> NodeMetadata;
    fn new(params: Option<Value>, logger: Logger) -> Result<Self, String>;
    fn process(
        &mut self,
        pin: &str,
        packet: Packet,
        output: &OutputSender,
    ) -> Result<(), String>;

    // Provided methods
    fn update_params(&mut self, _params: Option<Value>) -> Result<(), String> { ... }
    fn flush(&mut self, _output: &OutputSender) -> Result<(), String> { ... }
    fn cleanup(&mut self) { ... }
}
Expand description

Trait that plugin authors implement This provides an ergonomic Rust interface that gets wrapped with C ABI exports

Required Methods§

Source

fn metadata() -> NodeMetadata

Return metadata about this node type

Source

fn new(params: Option<Value>, logger: Logger) -> Result<Self, String>

Create a new instance of the node

§Errors

Returns an error if initialization fails (e.g., invalid parameters)

Source

fn process( &mut self, pin: &str, packet: Packet, output: &OutputSender, ) -> Result<(), String>

Process an incoming packet

§Errors

Returns an error if packet processing fails

Provided Methods§

Source

fn update_params(&mut self, _params: Option<Value>) -> Result<(), String>

Update runtime parameters (optional)

§Errors

Returns an error if parameter update fails (e.g., invalid values)

Source

fn flush(&mut self, _output: &OutputSender) -> Result<(), String>

Flush any buffered data when input stream ends (optional)

Called when the input stream closes, allowing plugins to process any remaining buffered data before cleanup. This is useful for nodes that buffer input (e.g., sentence splitting in TTS, frame buffering in codecs).

§Errors

Returns an error if flushing fails

Source

fn cleanup(&mut self)

Clean up resources (optional)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§