3 stable releases

1.1.0 Jul 15, 2020
1.0.1 Nov 23, 2019
Download history 39/week @ 2021-04-07 30/week @ 2021-04-14 29/week @ 2021-04-21 17/week @ 2021-04-28 11/week @ 2021-05-05 13/week @ 2021-05-12 12/week @ 2021-05-19 12/week @ 2021-05-26 13/week @ 2021-06-02 17/week @ 2021-06-09 10/week @ 2021-06-16 12/week @ 2021-06-23 23/week @ 2021-06-30 19/week @ 2021-07-07 20/week @ 2021-07-14 25/week @ 2021-07-21

77 downloads per month
Used in 26 crates (2 directly)

MIT license

5KB
132 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>,
}

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

Dependencies

~0.8–1.5MB
~33K SLoC