pub struct PluginHandle { /* private fields */ }Expand description
A handle to a loaded plugin, ready for calling methods.
Holds an Arc<Library> to keep the dylib loaded as long as any handle exists.
Call methods via call_method() which handles serialization, FFI, and cleanup.
PluginHandle is Send + Sync. Plugin methods take &self (enforced by
the macro), so concurrent calls from multiple threads are safe as long as
the plugin implementation is thread-safe internally.
Implementations§
Source§impl PluginHandle
impl PluginHandle
Sourcepub fn from_loaded(plugin: LoadedPlugin) -> Self
pub fn from_loaded(plugin: LoadedPlugin) -> Self
Create a PluginHandle from a LoadedPlugin.
Sourcepub fn call_method<I: Serialize, O: DeserializeOwned>(
&self,
index: usize,
input: &I,
) -> Result<O, CallError>
pub fn call_method<I: Serialize, O: DeserializeOwned>( &self, index: usize, input: &I, ) -> Result<O, CallError>
Call a plugin method by vtable index.
Serializes the input, calls the FFI function pointer at the given index, checks the status code, deserializes the output, and frees the plugin-allocated buffer.
§Arguments
index- The method index in the vtable (0-based, in declaration order)input- The input argument to serialize and pass to the plugin
Sourcepub fn has_capability(&self, bit: u32) -> bool
pub fn has_capability(&self, bit: u32) -> bool
Check if an optional method is supported (capability bit is set).
Returns false for bit indices >= 64 rather than panicking.
Sourcepub fn info(&self) -> &PluginInfo
pub fn info(&self) -> &PluginInfo
Access the plugin’s owned metadata.