[−][src]Struct lv2::prelude::URID
Representation of a URI for fast comparisons.
A URID is basically a number which represents a URI, which makes the identification of other features faster and easier. The mapping of URIs to URIDs is handled by a something that implements the Map
trait. A given URID can also be converted back to a URI with an implementation of the Unmap
trait. However, these implementations should obviously be linked.
This struct has an optional type parameter T
which defaults to ()
. In this case, the type can represent any URID at all, but if T
is a UriBound
, the instance of URID<T>
can only describe the URID of the given bound. This makes creation easier and also turns it into an atomic URIDCollection
, which can be used to build bigger collections.
Implementations
impl URID<()>
[src]
pub fn new(raw_urid: u32) -> Option<URID<()>>
[src]
Creates a new URID from a raw number.
URIDs may never be zero. If the given number is zero, None
is returned.
impl<T> URID<T> where
T: ?Sized,
[src]
T: ?Sized,
pub unsafe fn new_unchecked(raw_urid: u32) -> URID<T>
[src]
Create a URID without checking for type or value validity.
This value may only be a URID the mapper actually produced and that is recognised by a compatible unmapper. Therefore, it should only be used by Map::map_uri
or Map::map_type
.
Safety
A URID may not be 0 since this value is reserved for the None
value of Option<URID<T>>
, which therefore has the same size as a URID<T>
. If T
is also a URI bound, the URID may only be the one that is mapped to the bounded URI.
Since these constraints aren't checked by this method, it is unsafe. Using this method is technically sound as long as raw_urid
is not zero, but might still result in bad behaviour if its the wrong URID for the bound T
.
pub fn get(self) -> u32
[src]
Return the raw URID number.
pub fn into_general(self) -> URID<()>
[src]
Transform the type-specific URID into a generalized one.
Trait Implementations
impl<T> Clone for URID<T> where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Copy for URID<T> where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Debug for URID<T> where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Eq for URID<T> where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Hash for URID<T> where
T: ?Sized,
[src]
T: ?Sized,
pub fn hash<H>(&self, state: &mut H) where
H: Hasher,
[src]
H: Hasher,
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T> Ord for URID<T> where
T: ?Sized,
[src]
T: ?Sized,
pub fn cmp(&self, other: &URID<T>) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<T1, T2> PartialEq<URID<T1>> for URID<T2> where
T1: ?Sized,
T2: ?Sized,
[src]
T1: ?Sized,
T2: ?Sized,
pub fn eq(&self, other: &URID<T1>) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<T> PartialEq<u32> for URID<T> where
T: ?Sized,
[src]
T: ?Sized,
impl<T1, T2> PartialOrd<URID<T1>> for URID<T2> where
T1: ?Sized,
T2: ?Sized,
[src]
T1: ?Sized,
T2: ?Sized,
pub fn partial_cmp(&self, other: &URID<T1>) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<T> PartialOrd<u32> for URID<T> where
T: ?Sized,
[src]
T: ?Sized,
pub fn partial_cmp(&self, other: &u32) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl TryFrom<u32> for URID<()>
[src]
type Error = ()
The type returned in the event of a conversion error.
pub fn try_from(value: u32) -> Result<URID<()>, ()>
[src]
impl<T> URIDCollection for URID<T> where
T: UriBound + ?Sized,
[src]
T: UriBound + ?Sized,
Auto Trait Implementations
impl<T: ?Sized> RefUnwindSafe for URID<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T: ?Sized> Send for URID<T> where
T: Send,
T: Send,
impl<T: ?Sized> Sync for URID<T> where
T: Sync,
T: Sync,
impl<T: ?Sized> Unpin for URID<T> where
T: Unpin,
T: Unpin,
impl<T: ?Sized> UnwindSafe for URID<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,