pub unsafe trait Token<Keyhole> {
    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

Implementors