Trait PluginLoader

Source
pub trait PluginLoader {
    // Required methods
    fn bytes(&self) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, Error>>>>;
    fn name(&self) -> &'static str;
}
Expand description

A trait for loading plugin module data asynchronously.

This trait defines the behavior for loading plugin module data asynchronously. Implementors of this trait provide the ability to asynchronously retrieve the Wasm module data for a plugin.

Required Methods§

Source

fn bytes(&self) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, Error>>>>

Asynchronously loads the Wasm module data for the plugin.

This method returns a Future that produces a Result containing the Wasm module data as a Vec<u8> on success, or an anyhow::Error if loading encounters issues.

§Returns

Returns a Pin<Box<dyn Future<Output = Result<Vec<u8>, anyhow::Error>>>> representing the asynchronous loading process.

Source

fn name(&self) -> &'static str

A plugins name should be known before loading. It might just be std::any::type_name::<Self>()

Implementors§