pub struct DefaultToken(/* private fields */);Expand description
A small token that’s also checked at runtime, ensuring that a TokenCell is never accidentally used with another instance of the same token type.
Trait Implementations§
Source§impl TokenTrait for DefaultToken
impl TokenTrait for DefaultToken
Source§type ConstructionError = Infallible
type ConstructionError = Infallible
Constructing a token may fail.
Source§type RunError = Infallible
type RunError = Infallible
TokenTrait::with_token may fail, typically if construction failed. Read moreSource§type ComparisonError = IdMismatch
type ComparisonError = IdMismatch
core::convert::Infallible unless TokenTrait::compare is fallible (ie. comparison is done at runtime).Source§type Branded<'a> = DefaultToken
type Branded<'a> = DefaultToken
Rebrands the token, this is necessary for
GhostToken to function properlySource§fn with_token<R, F: FnOnce(Self) -> R>(f: F) -> Result<R, Self::RunError>
fn with_token<R, F: FnOnce(Self) -> R>(f: F) -> Result<R, Self::RunError>
Constructs a new, lifetime-branded Token, and provides it to the closure. Read more
Source§fn identifier(&self) -> Self::Identifier
fn identifier(&self) -> Self::Identifier
Returns the Token’s identifier, which cells may store to allow comparison.
Source§fn compare(&self, id: &Self::Identifier) -> Result<(), Self::ComparisonError>
fn compare(&self, id: &Self::Identifier) -> Result<(), Self::ComparisonError>
Allows the cell to compare its identifier to the Token. Read more
Auto Trait Implementations§
impl Freeze for DefaultToken
impl RefUnwindSafe for DefaultToken
impl Send for DefaultToken
impl Sync for DefaultToken
impl Unpin for DefaultToken
impl UnwindSafe for DefaultToken
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more