pub struct PluginHandle<P = Plugin> { /* private fields */ }
Expand description
A handle to a loaded plugin instance.
This struct represents a handle to a loaded plugin instance. It holds a reference
to the underlying instance, along with a reference to the associated store and
any additional data (PhantomData<P>
) specific to the plugin type P
.
§Type Parameters
P
: The plugin type that corresponds to this handle.
Implementations§
Source§impl<D> PluginHandle<Plugin<D>>
impl<D> PluginHandle<Plugin<D>>
Sourcepub async fn get_func<I: Serialize, R: DeserializeOwned>(
&self,
name: &str,
) -> Result<Func<Plugin<D>, I, R>>
pub async fn get_func<I: Serialize, R: DeserializeOwned>( &self, name: &str, ) -> Result<Func<Plugin<D>, I, R>>
Retrieves a typed function interface from the loaded plugin instance.
This method enables retrieving a typed function interface for a specific function name defined in the loaded plugin instance. The typed function interface provides a convenient way to invoke plugin functions and deserialize their input and output data.
§Parameters
name
: The name of the function in the plugin instance.
§Type Parameters
I
: The input data type expected by the function.R
: The output data type returned by the function.
§Returns
Returns a Result
containing the typed function interface on success,
or an anyhow::Error
if the function retrieval encounters any issues.
Trait Implementations§
Source§impl<P: Clone> Clone for PluginHandle<P>
impl<P: Clone> Clone for PluginHandle<P>
Source§fn clone(&self) -> PluginHandle<P>
fn clone(&self) -> PluginHandle<P>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<P> Freeze for PluginHandle<P>
impl<P = Plugin> !RefUnwindSafe for PluginHandle<P>
impl<P> Send for PluginHandle<P>
impl<P> Sync for PluginHandle<P>
impl<P> Unpin for PluginHandle<P>
impl<P = Plugin> !UnwindSafe for PluginHandle<P>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more