2 releases
0.3.1 | Jan 12, 2024 |
---|---|
0.3.0 | Jan 2, 2024 |
0.2.1 |
|
0.1.3 |
|
#1307 in Rust patterns
70 downloads per month
Used in toast-cell
7KB
112 lines
type-factory
Generates unique values of opaque types.
lib.rs
:
type_factory
Generates unique values of opaque types.
Usage
with(|initial/*: Initial<'_> */| {
let (a, b) = split(initial);
let (b, c) = split(b);
// `a`, `b`, and `c` are each of a distinct `impl '_ + Unique` type.
});
impl [Unique]
values are guaranteed to be unique. They cannot
be copied or cloned and are suitable for use as brand types.
The toast-cell
crate utilizes this
property.
Minimum supported Rust version
The MSRV is currently 1.56.
This may change between minor releases.
License
I release this crate into the public domain using the Unlicense.
Similar crates
generativity
provides a macro to
generate unique invariant lifetimes. It does not require dependent code to
reside within a closure.