2 releases

0.3.1 Jan 12, 2024
0.3.0 Jan 2, 2024
0.2.1 Dec 29, 2023
0.1.3 Dec 30, 2023

#1365 in Rust patterns

Download history 2/week @ 2024-01-23 1/week @ 2024-02-20 18/week @ 2024-02-27 26/week @ 2024-04-02 2/week @ 2024-04-09 145/week @ 2024-04-16 1/week @ 2024-04-23

148 downloads per month
Used in toast-cell

Unlicense

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.

No runtime deps