Skip to main content

DefaultPluginFactory

Trait DefaultPluginFactory 

Source
pub trait DefaultPluginFactory: Plugin {
    // Required methods
    fn get_descriptor() -> PluginDescriptor;
    fn new_shared(
        host: HostSharedHandle<'_>,
    ) -> Result<Self::Shared<'_>, PluginError>;
    fn new_main_thread<'a>(
        host: HostMainThreadHandle<'a>,
        shared: &'a Self::Shared<'a>,
    ) -> Result<Self::MainThread<'a>, PluginError>;
}
Expand description

An optional trait used by SinglePluginEntry that provides simplified, methods for generic plugin factories.

Implementing this trait is optional: you can disregard it completely if you use a custom factory, which also allows you to pass additional parameters to these methods, for e.g. sharing data across multiple instances.

See the SinglePluginEntry documentation for more information and examples.

Required Methods§

Source

fn get_descriptor() -> PluginDescriptor

Returns a new Plugin Descriptor, which contains metadata about the plugin, such as its name, stable identifier, and more.

See the PluginDescriptor type’s documentation for more information.

Source

fn new_shared( host: HostSharedHandle<'_>, ) -> Result<Self::Shared<'_>, PluginError>

Creates a new instance of this shared data.

This struct receives a thread-safe host handle that can be stored for the lifetime of the plugin.

§Errors

This operation may fail for any reason, in which case Err is returned and the plugin is not instantiated.

Source

fn new_main_thread<'a>( host: HostMainThreadHandle<'a>, shared: &'a Self::Shared<'a>, ) -> Result<Self::MainThread<'a>, PluginError>

Creates a new instance of the plugin’s main thread.

This struct receives an exclusive host handle that can be stored for the lifetime of the plugin.

§Errors

This operation may fail for any reason, in which case Err is returned and the plugin is not instantiated.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§