pub struct PluginHandle { /* private fields */ }Expand description
A handle to a loaded plugin, ready for calling methods.
Holds the active execution backend. call_method() handles serialization,
dispatch, and cleanup; concurrent calls from multiple threads are safe as
long as the underlying plugin is thread-safe (the cdylib macro enforces
&self-only methods; the Python backend serialises through the GIL).
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 freshly loaded cdylib plugin.
Sourcepub fn from_descriptor(
desc: &'static PluginDescriptor,
) -> Result<Self, LoadError>
pub fn from_descriptor( desc: &'static PluginDescriptor, ) -> Result<Self, LoadError>
Create a PluginHandle from a descriptor already registered in the
current process’s inventory (a #[plugin_impl] linked as a normal
rlib). No dylib is loaded. Used by Client::in_process(plugin_name).
Sourcepub fn find_in_process_descriptor(
plugin_name: &str,
) -> Result<&'static PluginDescriptor, LoadError>
pub fn find_in_process_descriptor( plugin_name: &str, ) -> Result<&'static PluginDescriptor, LoadError>
Look up a descriptor in the current process’s inventory registry by
plugin_name (the Rust struct name passed to #[plugin_impl]).
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 with the backend’s native wire (cdylib → bincode;
Python/WASM → fidius_core::Value), dispatches, and decodes the
result into O. No built-in timeout — see the fidius crate docs.
Sourcepub fn call_method_raw(
&self,
index: usize,
input: &[u8],
) -> Result<Vec<u8>, CallError>
pub fn call_method_raw( &self, index: usize, input: &[u8], ) -> Result<Vec<u8>, CallError>
Call a #[wire(raw)] method: raw bytes in, raw bytes out, no bincode.
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 set).
Returns false for bit >= 64 and for backends without capabilities.
Sourcepub fn info(&self) -> &PluginInfo
pub fn info(&self) -> &PluginInfo
Access the plugin’s owned metadata.
Sourcepub fn method_metadata(&self, method_id: u32) -> Vec<(&str, &str)>
pub fn method_metadata(&self, method_id: u32) -> Vec<(&str, &str)>
Static #[method_meta(...)] key/value metadata for the given method,
in declaration order. Empty for out-of-range ids, for interfaces that
declared none, and for backends without descriptor metadata.
Sourcepub fn trait_metadata(&self) -> Vec<(&str, &str)>
pub fn trait_metadata(&self) -> Vec<(&str, &str)>
Static #[trait_meta(...)] key/value metadata declared on the trait.
Empty when none was declared or for backends without descriptor metadata.