Crate streamkit_plugin_sdk_native

Crate streamkit_plugin_sdk_native 

Source
Expand description

StreamKit Native Plugin SDK

This SDK provides an ergonomic Rust interface for writing native plugins that use a stable C ABI. While the interface feels like pure Rust, under the hood it generates C-compatible exports for maximum binary compatibility.

§Example

use streamkit_plugin_sdk_native::prelude::*;

pub struct MyPlugin {
    // plugin state
}

impl NativeProcessorNode for MyPlugin {
    fn metadata() -> NodeMetadata {
        NodeMetadata::builder("my_plugin")
            .input("in", &[PacketType::Any])
            .output("out", PacketType::Any)
            .build()
    }

    fn new(_params: Option<serde_json::Value>, _logger: Logger) -> Result<Self, String> {
        Ok(Self {})
    }

    fn process(
        &mut self,
        _pin: &str,
        packet: Packet,
        output: &OutputSender,
    ) -> Result<(), String> {
        output.send("out", &packet)?;
        Ok(())
    }
}

native_plugin_entry!(MyPlugin);

Re-exports§

pub use streamkit_core;
pub use types::*;

Modules§

conversions
Type conversions between C ABI types and Rust types
logger
Logging utilities for native plugins
prelude
Re-export commonly used types
types
C ABI types for native plugins

Macros§

native_plugin_entry
Macro to generate C ABI exports for a plugin
plugin_debug
plugin_error
plugin_info
plugin_log
Helper macros for logging with tracing-style field syntax support
plugin_trace
plugin_warn

Structs§

NodeMetadata
Metadata about a node type
NodeMetadataBuilder
Builder for NodeMetadata
OutputSender
Output sender for sending packets to output pins

Traits§

NativeProcessorNode
Trait that plugin authors implement This provides an ergonomic Rust interface that gets wrapped with C ABI exports
ResourceSupport
Optional trait for plugins that need shared resource management (e.g., ML models).