pub trait TokenTrait: Sized {
    type ConstructionError;
    type RunError;
    type Identifier;
    type ComparisonError;

    fn new() -> Result<Self, Self::ConstructionError>;
    fn with_token<R, F: FnOnce(Self) -> R>(f: F) -> Result<R, Self::RunError>;
    fn identifier(&self) -> Self::Identifier;
    fn compare(&self, id: &Self::Identifier) -> Result<(), Self::ComparisonError>;
}
Expand description

A trait for tokens

Required Associated Types§

Required Methods§

Constructs a new Token.

Constructs a new Token, and provides it to the closure.

While this should allow to provide a traitified version of ghost-cell, it seems the compiler only detects the lifetime invariance with inherent methods.

Returns the Token’s identifier, which cells may store to allow comparison.

Allows the cell to compare its identifier to the Token.

Implementors§