Crates.io | singleton-trait |
lib.rs | singleton-trait |
version | 0.4.0 |
source | src |
created_at | 2021-07-09 18:20:08.938297 |
updated_at | 2022-05-07 18:35:34.357177 |
description | Singleton trait for types with unique values and Erased type for zero-sized ownership proofs |
homepage | |
repository | https://gitlab.com/jcarr0/singleton-trait |
max_upload_size | |
id | 420854 |
size | 16,154 |
This library provides simple unsafe traits for types with global uniqueness properties, as well as the Erased class for proofs. This crate does not provide implementation strategies, but does provide several examples of valid implementers.
Primarily, it is intended to be used for ghost proofs, in which ownership of a value of particular type is sufficient in order for other safety conditions.
The type Erased<T>
and the trait Exists<T>
are additionally provided as zero-sized
proofs of ownership of a type (including references) when existence is enough for safety.