pub struct PluginSharedHandle<'a> { /* private fields */ }Expand description
A thread-safe handle to the plugin instance.
This can be used to make requests to the plugin that support being made from any threads.
Implementations§
Sourcepub const fn descriptor(&self) -> Option<&'a PluginDescriptor>
pub const fn descriptor(&self) -> Option<&'a PluginDescriptor>
Returns the PluginDescriptor this instance corresponds to.
This may return None if the underlying plugin implementation didn’t properly populate
the descriptor pointer.
Sourcepub const fn as_raw(&self) -> &'a clap_plugin
pub const fn as_raw(&self) -> &'a clap_plugin
Returns a shared reference to the raw, C-FFI compatible plugin instance struct.
This type enforces that the reference is valid for the lifetime of the instance ('a).
If you need to access the raw pointer without dereferencing it first, use
as_raw_ptr instead.
Sourcepub const fn as_raw_ptr(&self) -> *const clap_plugin
pub const fn as_raw_ptr(&self) -> *const clap_plugin
Returns a raw pointer to the raw, C-FFI compatible plugin instance struct, without dereferencing it.
If you need to safely access the plugin instance struct through a shared reference,
use as_raw instead.
Sourcepub fn get_extension<E: Extension<ExtensionSide = PluginExtensionSide>>(
&self,
) -> Option<E>
pub fn get_extension<E: Extension<ExtensionSide = PluginExtensionSide>>( &self, ) -> Option<E>
Retrieves the plugin’s pointer to the given extension type E.
This returns None if the plugin does not support the given extension.
§Example
use clack_extensions::params::{PluginParams};
use clack_host::plugin::PluginSharedHandle;
let info: PluginSharedHandle = /* ... */
if let Some(params) = info.get_extension::<PluginParams>() {
// The params extension is supported by this plugin
} else {
// The params extension is not supported by this plugin
}Sourcepub fn use_extension<E: Sized>(
&self,
extension: &RawExtension<PluginExtensionSide, E>,
) -> &'a E
pub fn use_extension<E: Sized>( &self, extension: &RawExtension<PluginExtensionSide, E>, ) -> &'a E
Safely dereferences a RawExtension pointer produced by this plugin instance.
See the documentation of the RawExtension type for more information about how this works
internally.
§Panics
This method will panic if the given extension pointer does not match the plugin instance of this handle.
Trait Implementations§
Source§fn clone(&self) -> PluginSharedHandle<'a>
fn clone(&self) -> PluginSharedHandle<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more