Skip to main content

PluginHandle

Struct PluginHandle 

Source
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

Source

pub fn from_loaded(plugin: LoadedPlugin) -> Self

Create a PluginHandle from a freshly loaded cdylib plugin.

Source

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).

Source

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]).

Source

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.

Source

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.

Source

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.

Source

pub fn info(&self) -> &PluginInfo

Access the plugin’s owned metadata.

Source

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.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more