pub struct ClapId(/* private fields */);Expand description
A standardized CLAP identifier.
Identifiers in CLAP are 32-bit unsigned integers, but where the u32::MAX value is invalid.
This invalid value is generally used in the CLAP ABI to indicate failure.
This type ensures that the invalid value (i.e. u32::MAX) is never used in place of an actual
CLAP ID.
§Example
use clack_common::utils::ClapId;
let id: ClapId = ClapId::new(42);
assert_eq!(42, id.get());Implementations§
Source§impl ClapId
impl ClapId
Sourcepub const fn new(id: u32) -> ClapId
pub const fn new(id: u32) -> ClapId
Creates a new CLAP identifier from its numeric value.
§Panics
This function will panic if id is u32::MAX.
For a non-panicking version, see ClapId::from_raw.
Sourcepub const fn from_raw(raw: u32) -> Option<ClapId>
pub const fn from_raw(raw: u32) -> Option<ClapId>
Creates a new CLAP identifier from its raw numeric value.
Returns None if the given id is u32::MAX.
For a panicking version that returns the ClapId directly, see ClapId::new.
Trait Implementations§
impl Copy for ClapId
impl Eq for ClapId
Source§impl Ord for ClapId
impl Ord for ClapId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for ClapId
impl PartialOrd for ClapId
Source§impl PartialOrd<u32> for ClapId
impl PartialOrd<u32> for ClapId
impl StructuralPartialEq for ClapId
Auto Trait Implementations§
impl Freeze for ClapId
impl RefUnwindSafe for ClapId
impl Send for ClapId
impl Sync for ClapId
impl Unpin for ClapId
impl UnsafeUnpin for ClapId
impl UnwindSafe for ClapId
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more