Crate token_cell

Crate token_cell 

Source
Expand description

This library provides an alternative to ghost-cell which uses concrete types instead of lifetimes for branding.

This allows a more convenient usage, where cells and tokens can be constructed independently, with the same compile-time guarantees as ghost-cell. The trade-off for this arguably more convenient usage and arguably easier to understand branding method is that tokens, while zero-sized if made correctly, must be guaranteed to be constructable only if no other instance exists.

Re-exports§

pub use crate::macros::token;

Modules§

core
The core aspects of token_cell
ghost
A traitified version of ghost_cell.
macros
The macros to construct tokens.
monads
Because monads are cool.
prelude
The basis for using token_cell

Macros§

paste
runtime_token
Produces tokens that are also checked at runtime, ensuring that a TokenCell is never accidentally used with another instance of the same token type.
singleton_token
Produces tokens whose only identifier is their type, but is built such that only one instance of it can exist at any given time.
unsafe_token
Produces tokens whose only identifier is their type.

Structs§

RuntimeToken
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.