[][src]Struct urid::URID

#[repr(transparent)]pub struct URID<T = ()>(_, _)
where
    T: ?Sized
;

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.

Methods

impl URID<()>[src]

pub fn new(raw_urid: u32) -> Option<Self>[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: ?Sized> URID<T>[src]

pub unsafe fn new_unchecked(raw_urid: u32) -> Self[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: ?Sized> Clone for URID<T>[src]

impl<T: ?Sized> Copy for URID<T>[src]

impl<T: ?Sized> Debug for URID<T>[src]

impl<T: ?Sized> Eq for URID<T>[src]

impl<T: ?Sized> Hash for URID<T>[src]

impl<T: ?Sized> Ord for URID<T>[src]

impl<T: ?Sized> PartialEq<URID<T>> for u32[src]

impl<T1: ?Sized, T2: ?Sized> PartialEq<URID<T1>> for URID<T2>[src]

impl<T: ?Sized> PartialEq<u32> for URID<T>[src]

impl<T: ?Sized> PartialOrd<URID<T>> for u32[src]

impl<T1: ?Sized, T2: ?Sized> PartialOrd<URID<T1>> for URID<T2>[src]

impl<T: ?Sized> PartialOrd<u32> for URID<T>[src]

impl TryFrom<u32> for URID[src]

type Error = ()

The type returned in the event of a conversion error.

impl<T: UriBound + ?Sized> URIDCollection for URID<T>[src]

Auto Trait Implementations

impl<T: ?Sized> RefUnwindSafe for URID<T> where
    T: RefUnwindSafe

impl<T: ?Sized> Send for URID<T> where
    T: Send

impl<T: ?Sized> Sync for URID<T> where
    T: Sync

impl<T: ?Sized> Unpin for URID<T> where
    T: Unpin

impl<T: ?Sized> UnwindSafe for URID<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.