[Awesome Rust] uuid Provides support for Universally Unique Identifiers (UUIDs)
uuid
uuid Provides support for Universally Unique Identifiers (UUIDs). A UUID is a unique 128-bit number, stored as 16 octets. UUIDs are used to assign unique identifiers to entities without requiring a central allocating authority.
Dependencies
By default, this crate depends on nothing but std
and cannot generate UUIDs. You need to enable the following Cargo features to enable various pieces of functionality:
-
v1
- adds theUuid::new_v1
function and the ability to create a V1 using an implementation of
v1::ClockSequence
(usuallyv1::Context
) and a timestamp fromtime::timespec
. -
v3
- adds theUuid::new_v3
function and the ability to create a V3 UUID based on the MD5 hash of some data. -
v4
- adds theUuid::new_v4
function and the ability to randomly generate a UUID. -
v5
- adds theUuid::new_v5
function and the ability to create a V5 UUID based on the SHA1 hash of some data. -
serde
- adds the ability to serialize and deserialize a UUID using the serde crate.
For WebAssembly, enable one of the following features depending on your JavaScript interop toolchain of choice:
-
stdweb
- for stdweb combined with cargo-web -
wasm-bindgen
- for wasm-bindgen
By default, uuid can be depended on with:
1 | # Cargo.toml |
To activate various features, use syntax like:
1 | # Cargo.toml |
You can disable default features with:
1 | # Cargo.toml |
Examples
1 | use uuid::Uuid; |
References
[1] uuid-rs/uuid: Generate and parse UUIDs. - https://github.com/uuid-rs/uuid
[2] uuid - crates.io: Rust Package Registry - https://crates.io/crates/uuid