4 stable releases

1.1.1 Oct 17, 2021
1.1.0 Jul 15, 2020
1.0.1 Nov 23, 2019

#46 in #typed

Download history 216/week @ 2024-07-19 176/week @ 2024-07-26 179/week @ 2024-08-02 197/week @ 2024-08-09 191/week @ 2024-08-16 215/week @ 2024-08-23 213/week @ 2024-08-30 158/week @ 2024-09-06 171/week @ 2024-09-13 213/week @ 2024-09-20 115/week @ 2024-09-27 105/week @ 2024-10-04 285/week @ 2024-10-11 190/week @ 2024-10-18 182/week @ 2024-10-25 324/week @ 2024-11-01

984 downloads per month
Used in 87 crates (10 directly)

MIT license

6KB
133 lines

TypId

Typed Unique Identifier gives you ability to create and use identifiers bound to specified type.

Installation

Cargo.toml

[dependencies]
typid = "1"

Example

use typid::ID;

struct Foo {
    pub id: ID<Foo>,
}

fn main() {
    let a = Foo { id: ID::new() };
    let b = Foo { id: ID::new() };
    assert_ne!(a.id, b.id);
}

lib.rs:

Typed Unique Identifier gives you ability to create and use identifiers bound to specified type.

Typical usage example:

use typid::ID;

struct Foo {
    pub id: ID<Foo>,
}

let a = Foo { id: ID::new() };
let b = Foo { id: ID::new() };
assert_ne!(a.id, b.id);

Dependencies

~0.6–1.5MB
~31K SLoC