Struct token_cell::ghost::GhostToken
source · pub struct GhostToken<'brand>(_);Expand description
WARNING: This attempt at recreating GhostCell but with traits does NOT work.
I am leaving this here because I believe there may exist a way to make this type of token work, and anyone who has ideas of how to do so is welcome to try and make a PR.
To check your theory, clone this repo and use the ghost.rs example as a check for
your attempt. If your method works, the example should have some compile error.
Trait Implementations§
source§impl<'brand> TokenTrait for GhostToken<'brand>
impl<'brand> TokenTrait for GhostToken<'brand>
type ConstructionError = ()
type RunError = Infallible
type Identifier = InvariantLifetime<'brand>
type ComparisonError = Infallible
source§fn new() -> Result<Self, Self::ConstructionError>
fn new() -> Result<Self, Self::ConstructionError>
Constructs a new Token.
source§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 Token, and provides it to the closure. Read more
source§fn identifier(&self) -> InvariantLifetime<'brand>
fn identifier(&self) -> InvariantLifetime<'brand>
Returns the Token’s identifier, which cells may store to allow comparison.
source§fn compare(
&self,
_: &InvariantLifetime<'brand>
) -> Result<(), Self::ComparisonError>
fn compare(
&self,
_: &InvariantLifetime<'brand>
) -> Result<(), Self::ComparisonError>
Allows the cell to compare its identifier to the Token.