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§
Sourcefn metadata() -> NodeMetadata
fn metadata() -> NodeMetadata
Return metadata about this node type
Provided Methods§
Sourcefn update_params(&mut self, _params: Option<Value>) -> Result<(), String>
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)
Sourcefn flush(&mut self, _output: &OutputSender) -> Result<(), String>
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
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.