All Projects → uuid-rs → Uuid

uuid-rs / Uuid

Licence: other
Generate and parse UUIDs.

Programming Languages

rust
11053 projects

Labels

Projects that are alternatives of or similar to Uuid

php-tools
Some code snippets that are often used in PHP
Stars: ✭ 25 (-94.53%)
Mutual labels:  uuid
vue-uuid
Add UUID to Vue instance.
Stars: ✭ 55 (-87.96%)
Mutual labels:  uuid
Uniuri
Go package uniuri generates random strings good for use in URIs to identify unique objects.
Stars: ✭ 336 (-26.48%)
Mutual labels:  uuid
Butterfly
分布式ID生成器框架:超高性能的发号器框架。通过引入多种新的方案,彻底解决雪花算法的时间回拨等问题,并将雪花算法原生QPS提高最少十几~二十倍
Stars: ✭ 111 (-75.71%)
Mutual labels:  uuid
ulid-creator
A Java library for generating Universally Unique Lexicographically Sortable Identifiers (ULID)
Stars: ✭ 38 (-91.68%)
Mutual labels:  uuid
cyksuid
Fast Python implementation of KSUID (K-Sortable Globally Unique IDs) using Cython
Stars: ✭ 29 (-93.65%)
Mutual labels:  uuid
eav-bundle
A Symfony bundle for basic EAV management
Stars: ✭ 19 (-95.84%)
Mutual labels:  uuid
Laravel Eloquent Uuid
A simple drop-in solution for providing UUID support for the IDs of your Eloquent models.
Stars: ✭ 388 (-15.1%)
Mutual labels:  uuid
uuix
A tiny (<1KB) and fast UUID (v4) generator for Crystal
Stars: ✭ 17 (-96.28%)
Mutual labels:  uuid
Xyuuid
iOS14 UUID KeyChain DeviceInfo IDFA UDID
Stars: ✭ 301 (-34.14%)
Mutual labels:  uuid
micell
A collection of functions for front-end development
Stars: ✭ 16 (-96.5%)
Mutual labels:  uuid
secrets.clj
A library designed to generate cryptographically strong random numbers.
Stars: ✭ 64 (-86%)
Mutual labels:  uuid
shortuuid.rb
Convert UUIDs & numbers into space efficient and URL-safe Base62 strings, or any other alphabet.
Stars: ✭ 38 (-91.68%)
Mutual labels:  uuid
ksuid-go
K-Sortable globally Unique ID
Stars: ✭ 15 (-96.72%)
Mutual labels:  uuid
Android cn oaid
适用于国内各大Android手机厂商的开放匿名设备标识(OAID)解决方案,可替代移动安全联盟提供的 SDK 闭源方案(miit_mdid_xxx.aar)。
Stars: ✭ 370 (-19.04%)
Mutual labels:  uuid
Xid.Net
Ported from https://github.com/rs/xid - A fast, low allocation, zero config, thread-safe 12 byte UUID generator based on the Mongo Object Id algorithm.
Stars: ✭ 17 (-96.28%)
Mutual labels:  uuid
twitch-chat-visualizer
A Node.js Project. Would you like to see your chat stream with a custom design? This is for you!
Stars: ✭ 14 (-96.94%)
Mutual labels:  uuid
Go.uuid
UUID package for Go
Stars: ✭ 4,427 (+868.71%)
Mutual labels:  uuid
Go Nanoid
Golang random IDs generator.
Stars: ✭ 373 (-18.38%)
Mutual labels:  uuid
Newid
A sequential id generator that works across nodes with no collisions
Stars: ✭ 255 (-44.2%)
Mutual labels:  uuid

uuid

Latest Version Join the chat at https://gitter.im/uuid-rs/Lobby Minimum rustc version Build Status Build Status Average time to resolve an issue Percentage of issues still open FOSSA Status


Generate and parse UUIDs.

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.

They are particularly useful in distributed systems, though they can be used in disparate areas, such as databases and network protocols. Typically a UUID is displayed in a readable string form as a sequence of hexadecimal digits, separated into groups by hyphens.

The uniqueness property is not strictly guaranteed, however for all practical purposes, it can be assumed that an unintentional collision would be extremely unlikely.

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 the Uuid::new_v1 function and the ability to create a V1 using an implementation of uuid::v1::ClockSequence (usually uuid::v1::Context) and a timestamp from time::timespec.
  • v3 - adds the Uuid::new_v3 function and the ability to create a V3 UUID based on the MD5 hash of some data.
  • v4 - adds the Uuid::new_v4 function and the ability to randomly generate a Uuid.
  • v5 - adds the Uuid::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.

You need to enable one of the following Cargo features together with v3, v4 or v5 feature if you're targeting wasm32-unknown-unknown target:

  • stdweb - enables support for OsRng on wasm32-unknown-unknown via stdweb combined with cargo-web
  • wasm-bindgen - wasm-bindgen enables support for OsRng on wasm32-unknown-unknown via wasm-bindgen

By default, uuid can be depended on with:

[dependencies]
uuid = "0.8"

To activate various features, use syntax like:

[dependencies]
uuid = { version = "0.8", features = ["serde", "v4"] }

You can disable default features with:

[dependencies]
uuid = { version = "0.8", default-features = false }

Examples

To parse a UUID given in the simple format and print it as a urn:

use uuid::Uuid;

fn main() -> Result<(), uuid::Error> {
    let my_uuid =
        Uuid::parse_str("936DA01F9ABD4d9d80C702AF85C822A8")?;
    println!("{}", my_uuid.to_urn());
    Ok(())
}

To create a new random (V4) UUID and print it out in hexadecimal form:

// Note that this requires the `v4` feature enabled in the uuid crate.

use uuid::Uuid;

fn main() {
    let my_uuid = Uuid::new_v4();
    println!("{}", my_uuid);
    Ok(())
}

Strings

Examples of string representations:

  • simple: 936DA01F9ABD4d9d80C702AF85C822A8
  • hyphenated: 550e8400-e29b-41d4-a716-446655440000
  • urn: urn:uuid:F9168C5E-CEB2-4faa-B6BF-329BF39FA1E4

References


License

Licensed under either of

at your option.

FOSSA Status

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].