| Crates.io | token-cell |
| lib.rs | token-cell |
| version | 2.0.0 |
| created_at | 2021-08-27 09:47:50.157653+00 |
| updated_at | 2025-09-04 06:40:44.564653+00 |
| description | A more convenient GhostCell |
| homepage | |
| repository | https://github.com/p-avital/token-cell-rs |
| max_upload_size | |
| id | 443018 |
| size | 30,789 |
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.
To this end, this crate provides the generate_token macro, which will create a ZST which can only be constructed using TokenTrait::new.