Skip to main content

SinglePluginEntry

Struct SinglePluginEntry 

Source
pub struct SinglePluginEntry<P: DefaultPluginFactory> { /* private fields */ }
Expand description

An Entry that only exposes a single plugin type to the host.

This is a simplified entry type, which only requires the simple DefaultPluginFactory trait to be implemented by the user, and implements an entry and plugin factory around it.

This entry type exists purely for convenience of the users in the common case of having a single plugin type to expose to the host.

If you actually need to expose more plugin types, or to customize the entry’s behavior in some other way, see the Entry trait documentation for an example on how to implement your own custom entry.

§Example

use clack_plugin::entry::DefaultPluginFactory;
use clack_plugin::prelude::*;

pub struct MyPlugin;

impl Plugin for MyPlugin {
    type AudioProcessor<'a> = ();
    type Shared<'a> = ();
    type MainThread<'a> = ();
}

impl DefaultPluginFactory for MyPlugin {
    fn get_descriptor() -> PluginDescriptor {
        PluginDescriptor::new("my.plugin", "My Plugin")
    }

    fn new_shared<'a>(
        _host: HostSharedHandle<'a>
    ) -> Result<Self::Shared<'a>, PluginError> {
        Ok(())
    }

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

clack_export_entry!(SinglePluginEntry::<MyPlugin>);

Trait Implementations§

Source§

impl<P: DefaultPluginFactory> Entry for SinglePluginEntry<P>

Source§

fn new(_plugin_path: Option<&CStr>) -> Result<Self, EntryLoadError>

Instantiates the entry. Read more
Source§

fn declare_factories<'a>(&'a self, builder: &mut EntryFactories<'a>)

Declares the factories this entry exposes to the host, by registering them to the given EntryFactories builder. Read more

Auto Trait Implementations§

§

impl<P> Freeze for SinglePluginEntry<P>
where PluginFactoryWrapper<SinglePluginFactory<P>>: Freeze,

§

impl<P> RefUnwindSafe for SinglePluginEntry<P>
where PluginFactoryWrapper<SinglePluginFactory<P>>: RefUnwindSafe,

§

impl<P> Send for SinglePluginEntry<P>
where PluginFactoryWrapper<SinglePluginFactory<P>>: Send,

§

impl<P> Sync for SinglePluginEntry<P>
where PluginFactoryWrapper<SinglePluginFactory<P>>: Sync,

§

impl<P> Unpin for SinglePluginEntry<P>
where PluginFactoryWrapper<SinglePluginFactory<P>>: Unpin,

§

impl<P> UnsafeUnpin for SinglePluginEntry<P>
where PluginFactoryWrapper<SinglePluginFactory<P>>: UnsafeUnpin,

§

impl<P> UnwindSafe for SinglePluginEntry<P>
where PluginFactoryWrapper<SinglePluginFactory<P>>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.