Token

Trait Token 

Source
pub unsafe trait Token<Keyhole> {
    // Required method
    fn eq_id(&self, id: &Keyhole) -> bool;
}
Expand description

Trait for an unforgeable token used to access the contents of a TokenLock<_, Keyhole>.

A token can “open” a TokenLock only if the token matches the metaphorical keyhole.

§Safety

If safe code could obtain two instances of T: Token<_> x and y and an instance of a TokenLock-like type lock such that x and y can be mutably borrowed at the same time, and x.eq_id(lock.keyhole()) && y.eq_id(lock.keyhole()), it can invoke an undefined behavior by creating two mutable borrows of the same place.

Required Methods§

Source

fn eq_id(&self, id: &Keyhole) -> bool

Implementors§

Source§

impl Token<ArcTokenId> for ArcToken

Available on crate feature alloc and target_has_atomic="ptr" only.
Source§

impl Token<ArcTokenId> for ArcTokenUnsyncRef<'_>

Available on crate feature alloc and target_has_atomic="ptr" only.
Source§

impl Token<IcTokenId> for IcToken

Available on crate feature std only.
Source§

impl Token<IcTokenId> for IcTokenUnsyncRef<'_>

Available on crate feature std only.
Source§

impl Token<RcTokenId> for RcToken

Available on crate feature alloc only.
Source§

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