5 stable releases

new 1.1.2 Feb 13, 2025
1.1.1 Oct 17, 2021
1.1.0 Jul 15, 2020
1.0.1 Nov 23, 2019

#6 in #typed

Download history 384/week @ 2024-10-29 64/week @ 2024-11-05 217/week @ 2024-11-12 200/week @ 2024-11-19 360/week @ 2024-11-26 299/week @ 2024-12-03 279/week @ 2024-12-10 231/week @ 2024-12-17 86/week @ 2024-12-24 259/week @ 2024-12-31 234/week @ 2025-01-07 213/week @ 2025-01-14 158/week @ 2025-01-21 194/week @ 2025-01-28 263/week @ 2025-02-04 384/week @ 2025-02-11

1,058 downloads per month
Used in 96 crates (10 directly)

MIT license

6KB
129 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.3–1MB
~24K SLoC