Skip to main content

UniversalPluginId

Struct UniversalPluginId 

Source
pub struct UniversalPluginId<'a> {
    pub abi: &'a CStr,
    pub id: &'a CStr,
}
Expand description

A unique identifier that works across plugin APIs.

This is a (abi, id) pair of borrowed strings that live for the 'a lifetime.

Fields§

§abi: &'a CStr

The ABI string.

It can be e.g. “clap”, “vst2”, “vst3”, “au”, etc.

See UniversalPluginAbi::abi_str for known values this field can take.

§id: &'a CStr

The ID string of the plugin.

This is formatted differently depending on the ABI type:

  • CLAP: Use the plugin ID (e.g. "com.u-he.diva")
  • AU: Format the string as “type:subt:manu” (e.g. "aumu:SgXT:VmbA")
  • VST2: Format the ID as a signed 32-bit integer (e.g. "-4382976")
  • VST3: Format the ID as a hyphenated UUID (e.g. "123e4567-e89b-12d3-a456-426614174000")

Implementations§

Source§

impl<'a> UniversalPluginId<'a>

Source

pub const unsafe fn from_raw( raw: clap_universal_plugin_id, ) -> Option<UniversalPluginId<'a>>

Creates a UniversalPluginId from its raw, C-FFI compatible representation.

If either of the string pointers within the given struct are NULL, this returns None.

§Safety

Either of the contained pointers can be NULL, in which case the following requirements do not apply.

Both pointers must point to valid C strings, and remain valid for the duration of the 'a lifetime.

See the documentation of CStr::from_ptr for the exhaustive list of safety requirements.

Source

pub const unsafe fn from_raw_ptr( ptr: *const clap_universal_plugin_id, ) -> Option<UniversalPluginId<'a>>

Creates a UniversalPluginId from a pointer to its raw, C-FFI compatible representation.

If the given ptr, or either of the string pointers within the pointed struct are NULL, this returns None.

This function is a version of the from_raw method, except it allows to read directly from a raw pointer without actually borrowing it, which may be slightly safer.

§Safety

The given ptr must be well-aligned and valid for that. On top of that, the clap_universal_plugin_id value it points to must also satisfy the safety requirements of the from_raw method.

Source

pub const fn clap(id: &'a CStr) -> UniversalPluginId<'a>

Creates a UniversalPluginId for a CLAP plugin with a given id.

Source

pub const fn abi(&self) -> Option<UniversalPluginAbi>

Returns the UniversalPluginAbi matching this ID’s plugin ABI.

If the ABI type string doesn’t match a known UniversalPluginAbi variant, this returns None.

Source

pub const fn to_raw(&self) -> clap_universal_plugin_id

Returns a raw, C-FFI compatible representation of this ID.

The pointers contained in this struct are valid for the 'a lifetime.

Trait Implementations§

Source§

impl<'a> Clone for UniversalPluginId<'a>

Source§

fn clone(&self) -> UniversalPluginId<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for UniversalPluginId<'a>

Source§

impl<'a> Debug for UniversalPluginId<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'a> Eq for UniversalPluginId<'a>

Source§

impl<'a> Hash for UniversalPluginId<'a>

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'a> PartialEq for UniversalPluginId<'a>

Source§

fn eq(&self, other: &UniversalPluginId<'a>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<'a> StructuralPartialEq for UniversalPluginId<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for UniversalPluginId<'a>

§

impl<'a> RefUnwindSafe for UniversalPluginId<'a>

§

impl<'a> Send for UniversalPluginId<'a>

§

impl<'a> Sync for UniversalPluginId<'a>

§

impl<'a> Unpin for UniversalPluginId<'a>

§

impl<'a> UnsafeUnpin for UniversalPluginId<'a>

§

impl<'a> UnwindSafe for UniversalPluginId<'a>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.