Struct tokenlock::SingletonTokenId[][src]

pub struct SingletonTokenId<Tag: ?Sized>(_);

Token that cannot be used to access the contents of a TokenLock, but can be used to create a new TokenLock.

This type is invariant over Tag.

Examples

SingletonTokenId can be cloned while SingletonToken cannot:

struct MyTag;
impl_singleton_token_factory!(MyTag);
let token = SingletonToken::<MyTag>::new().unwrap();
let token_id = token.id();
let lock1 = TokenLock::new(token_id.clone(), 1);
let lock2 = TokenLock::new(token_id, 2);

Unlike other token types, you don't need to construct SingletonToken first, actually:

struct MyTag;
impl_singleton_token_factory!(MyTag);
let lock1 = TokenLock::new(SingletonTokenId::<MyTag>::new(), 1);
let lock2 = TokenLock::new(SingletonTokenId::<MyTag>::new(), 2);

Implementations

impl<Tag: ?Sized> SingletonTokenId<Tag>[src]

pub const fn new() -> Self[src]

Construct Self.

Trait Implementations

impl<Tag: ?Sized> Clone for SingletonTokenId<Tag>[src]

impl<Tag: ?Sized> Copy for SingletonTokenId<Tag>[src]

impl<Tag: ?Sized> Debug for SingletonTokenId<Tag>[src]

impl<Tag: ?Sized> Default for SingletonTokenId<Tag>[src]

impl<Tag: ?Sized> Eq for SingletonTokenId<Tag>[src]

impl<Tag: ?Sized> Hash for SingletonTokenId<Tag>[src]

impl<Tag: ?Sized> PartialEq<SingletonTokenId<Tag>> for SingletonTokenId<Tag>[src]

impl<Tag: ?Sized, Variant: SingletonTokenVariant> Token<SingletonTokenId<Tag>> for SingletonToken<Tag, Variant>[src]

Auto Trait Implementations

impl<Tag: ?Sized> RefUnwindSafe for SingletonTokenId<Tag>[src]

impl<Tag: ?Sized> Send for SingletonTokenId<Tag>[src]

impl<Tag: ?Sized> Sync for SingletonTokenId<Tag>[src]

impl<Tag: ?Sized> Unpin for SingletonTokenId<Tag>[src]

impl<Tag: ?Sized> UnwindSafe for SingletonTokenId<Tag>[src]

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.