4 stable releases

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

#39 in #unique-id

Download history 259/week @ 2023-12-06 416/week @ 2023-12-13 242/week @ 2023-12-20 442/week @ 2023-12-27 226/week @ 2024-01-03 239/week @ 2024-01-10 386/week @ 2024-01-17 225/week @ 2024-01-24 186/week @ 2024-01-31 199/week @ 2024-02-07 267/week @ 2024-02-14 221/week @ 2024-02-21 218/week @ 2024-02-28 233/week @ 2024-03-06 379/week @ 2024-03-13 392/week @ 2024-03-20

1,285 downloads per month
Used in 81 crates (9 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.7–1.6MB
~32K SLoC