Skip to main content

Crate rustbridge_ffi

Crate rustbridge_ffi 

Source
Expand description

rustbridge-ffi - C ABI exports and FFI buffer management

This crate provides the FFI boundary layer:

  • FfiBuffer for passing data across FFI
  • PluginHandle for managing plugin instances
  • C ABI exported functions (plugin_init, plugin_call, etc.)

§FFI Functions

The following functions are exported with C linkage:

  • plugin_init - Initialize a plugin instance
  • plugin_call - Make a synchronous request to the plugin
  • plugin_free_buffer - Free a buffer returned by plugin_call
  • plugin_shutdown - Shutdown a plugin instance
  • plugin_set_log_level - Set the log level for a plugin

Modules§

prelude
Prelude module for convenient imports

Macros§

plugin_entry
Macro to generate the FFI entry point for a plugin

Structs§

AsyncBridge
Bridge for executing async operations from sync FFI context
AsyncRuntime
Manages the Tokio async runtime for a plugin
FfiBuffer
Buffer for passing data across FFI boundary
PluginConfig
Plugin configuration passed during initialization
PluginContext
Context provided to plugin operations
PluginHandle
Handle to an initialized plugin instance
PluginHandleManager
Manages plugin handles
RbBytes
FFI-safe borrowed byte slice reference
RbBytesOwned
FFI-safe owned byte buffer
RbResponse
FFI buffer for binary transport responses
RbString
FFI-safe borrowed string reference
RbStringOwned
FFI-safe owned string
RequestEnvelope
Request envelope wrapping a message for FFI transport
ResponseEnvelope
Response envelope wrapping a response for FFI transport
RuntimeConfig
Configuration for the async runtime

Enums§

LogLevel
Log levels for FFI callbacks
PluginError
Error type for plugin operations

Traits§

Plugin
Main trait for implementing rustbridge plugins

Functions§

plugin_call
Make a synchronous call to the plugin
plugin_call_raw
Make a synchronous binary call to the plugin
plugin_free_buffer
Free a buffer returned by plugin_call
plugin_get_rejected_count
Get the number of requests rejected due to concurrency limits
plugin_get_state
Get the current state of a plugin
plugin_init
Initialize a plugin instance
plugin_set_log_level
Set the log level for a plugin
plugin_shutdown
Shutdown a plugin instance
rb_response_free
Free an RbResponse returned by plugin_call_raw
register_binary_handler
Register a binary message handler

Type Aliases§

BinaryMessageHandler
Handler function type for binary message processing
LogCallback
FFI callback function type for logging