Struct tokenlock::singleton::SingletonTokenId
source · [−]pub struct SingletonTokenId<Tag: ?Sized>(_);
Expand description
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
sourceimpl<Tag: ?Sized> SingletonTokenId<Tag>
impl<Tag: ?Sized> SingletonTokenId<Tag>
Trait Implementations
sourceimpl<Tag: ?Sized> Clone for SingletonTokenId<Tag>
impl<Tag: ?Sized> Clone for SingletonTokenId<Tag>
sourceimpl<Tag: ?Sized> ConstDefault for SingletonTokenId<Tag>
impl<Tag: ?Sized> ConstDefault for SingletonTokenId<Tag>
sourceimpl<Tag: ?Sized> Debug for SingletonTokenId<Tag>
impl<Tag: ?Sized> Debug for SingletonTokenId<Tag>
sourceimpl<Tag: ?Sized> Default for SingletonTokenId<Tag>
impl<Tag: ?Sized> Default for SingletonTokenId<Tag>
sourceimpl<Tag: ?Sized> Hash for SingletonTokenId<Tag>
impl<Tag: ?Sized> Hash for SingletonTokenId<Tag>
sourceimpl<Tag: ?Sized> PartialEq<SingletonTokenId<Tag>> for SingletonTokenId<Tag>
impl<Tag: ?Sized> PartialEq<SingletonTokenId<Tag>> for SingletonTokenId<Tag>
sourceimpl<Tag: ?Sized, Variant: SingletonTokenVariant> Token<SingletonTokenId<Tag>> for SingletonToken<Tag, Variant>
impl<Tag: ?Sized, Variant: SingletonTokenVariant> Token<SingletonTokenId<Tag>> for SingletonToken<Tag, Variant>
fn eq_id(&self, _: &SingletonTokenId<Tag>) -> bool
impl<Tag: ?Sized> Copy for SingletonTokenId<Tag>
impl<Tag: ?Sized> Eq for SingletonTokenId<Tag>
Auto Trait Implementations
impl<Tag: ?Sized> RefUnwindSafe for SingletonTokenId<Tag>
impl<Tag: ?Sized> Send for SingletonTokenId<Tag>
impl<Tag: ?Sized> Sync for SingletonTokenId<Tag>
impl<Tag: ?Sized> Unpin for SingletonTokenId<Tag>
impl<Tag: ?Sized> UnwindSafe for SingletonTokenId<Tag>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more