Struct plugy_runtime::PluginHandle
source · pub struct PluginHandle<P, D> { /* 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<P, D> PluginHandle<P, D>
impl<P, D> PluginHandle<P, D>
sourcepub async fn get_func<I: Serialize, R: DeserializeOwned>(
&self,
name: &str
) -> Result<Func<I, R, D>>
pub async fn get_func<I: Serialize, R: DeserializeOwned>( &self, name: &str ) -> Result<Func<I, R, D>>
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§
Auto Trait Implementations§
impl<P, D> !RefUnwindSafe for PluginHandle<P, D>
impl<P, D> Send for PluginHandle<P, D>where D: Send + Sync, P: Send,
impl<P, D> Sync for PluginHandle<P, D>where D: Send + Sync, P: Sync,
impl<P, D> Unpin for PluginHandle<P, D>where P: Unpin,
impl<P, D> !UnwindSafe for PluginHandle<P, D>
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