Skip to main content

ClientPlugin

Trait ClientPlugin 

Source
pub trait ClientPlugin: MaybeSendSync + 'static {
    type Api: MaybeSendSync + 'static;

    // Required methods
    fn manifest(&self) -> PluginManifest;
    fn install(
        &self,
        context: PluginContext,
    ) -> PluginFuture<'_, Result<Arc<Self::Api>>>;

    // Provided methods
    fn on_ready(
        &self,
        _scope: PluginConnectionScope,
    ) -> PluginFuture<'_, Result<()>> { ... }
    fn on_closed(
        &self,
        _scope: PluginConnectionScope,
    ) -> PluginFuture<'_, Result<()>> { ... }
    fn shutdown(&self) -> PluginFuture<'_, Result<()>> { ... }
}
Available on crate feature plugins only.
Expand description

A trusted native plugin installed exactly once while the client is still inert. Capabilities shape the handles it receives; they are not an in-process sandbox. A plugin value belongs to one client installation, even when registered through an Arc.

Required Associated Types§

Source

type Api: MaybeSendSync + 'static

Required Methods§

Source

fn manifest(&self) -> PluginManifest

Source

fn install( &self, context: PluginContext, ) -> PluginFuture<'_, Result<Arc<Self::Api>>>

Provided Methods§

Source

fn on_ready( &self, _scope: PluginConnectionScope, ) -> PluginFuture<'_, Result<()>>

Source

fn on_closed( &self, _scope: PluginConnectionScope, ) -> PluginFuture<'_, Result<()>>

Source

fn shutdown(&self) -> PluginFuture<'_, Result<()>>

Release plugin-owned state. This may run after install began but returned an error.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§