gecko-dev/third_party/rust/uuid
Myk Melez 4db9ccb1af Bug 1490496 - implement XPCOM FFI for key-value storage r=nika,lina,mossop
MozReview-Commit-ID: JnQzXG581DW

Differential Revision: https://phabricator.services.mozilla.com/D6328

--HG--
rename : third_party/rust/crossbeam-utils/.cargo-checksum.json => third_party/rust/crossbeam-utils-0.3.2/.cargo-checksum.json
rename : third_party/rust/crossbeam-utils/CHANGELOG.md => third_party/rust/crossbeam-utils-0.3.2/CHANGELOG.md
rename : third_party/rust/crossbeam-utils/Cargo.toml => third_party/rust/crossbeam-utils-0.3.2/Cargo.toml
rename : third_party/rust/crossbeam-utils/LICENSE-MIT => third_party/rust/crossbeam-utils-0.3.2/LICENSE-MIT
rename : third_party/rust/crossbeam-utils/README.md => third_party/rust/crossbeam-utils-0.3.2/README.md
rename : third_party/rust/crossbeam-utils/src/cache_padded.rs => third_party/rust/crossbeam-utils-0.3.2/src/cache_padded.rs
rename : third_party/rust/crossbeam-utils/src/consume.rs => third_party/rust/crossbeam-utils-0.3.2/src/consume.rs
rename : third_party/rust/crossbeam-utils/src/lib.rs => third_party/rust/crossbeam-utils-0.3.2/src/lib.rs
rename : third_party/rust/crossbeam-utils/src/scoped.rs => third_party/rust/crossbeam-utils-0.3.2/src/scoped.rs
rename : third_party/rust/crossbeam-utils/src/consume.rs => third_party/rust/crossbeam-utils/src/atomic/consume.rs
rename : third_party/rust/crossbeam-utils/Cargo.toml => third_party/rust/threadbound/Cargo.toml
rename : third_party/rust/crossbeam-utils/LICENSE-MIT => third_party/rust/threadbound/LICENSE-MIT
rename : third_party/rust/uuid/.cargo-checksum.json => third_party/rust/uuid-0.6.5/.cargo-checksum.json
rename : third_party/rust/uuid/CODE_OF_CONDUCT.md => third_party/rust/uuid-0.6.5/CODE_OF_CONDUCT.md
rename : third_party/rust/uuid/Cargo.toml => third_party/rust/uuid-0.6.5/Cargo.toml
rename : third_party/rust/crossbeam-utils/LICENSE-MIT => third_party/rust/uuid-0.6.5/LICENSE-MIT
rename : third_party/rust/uuid/README.md => third_party/rust/uuid-0.6.5/README.md
rename : third_party/rust/uuid/benches/parse_str.rs => third_party/rust/uuid-0.6.5/benches/parse_str.rs
rename : third_party/rust/uuid/src/adapter.rs => third_party/rust/uuid-0.6.5/src/adapter.rs
rename : third_party/rust/uuid/src/core_support.rs => third_party/rust/uuid-0.6.5/src/core_support.rs
rename : third_party/rust/uuid/src/lib.rs => third_party/rust/uuid-0.6.5/src/lib.rs
rename : third_party/rust/uuid/src/prelude.rs => third_party/rust/uuid-0.6.5/src/prelude.rs
rename : third_party/rust/uuid/src/serde_support.rs => third_party/rust/uuid-0.6.5/src/serde_support.rs
rename : third_party/rust/uuid/src/slog_support.rs => third_party/rust/uuid-0.6.5/src/slog_support.rs
rename : third_party/rust/uuid/src/std_support.rs => third_party/rust/uuid-0.6.5/src/std_support.rs
rename : third_party/rust/uuid/src/test_util.rs => third_party/rust/uuid-0.6.5/src/test_util.rs
rename : third_party/rust/uuid/src/u128_support.rs => third_party/rust/uuid-0.6.5/src/u128_support.rs
rename : third_party/rust/uuid/benches/parse_str.rs => third_party/rust/uuid/benches/invalid_parse_str.rs
rename : third_party/rust/uuid/src/std_support.rs => third_party/rust/uuid/src/parser/std_support.rs
extra : moz-landing-system : lando
2019-02-07 16:14:04 +00:00
..
benches Bug 1490496 - implement XPCOM FFI for key-value storage r=nika,lina,mossop 2019-02-07 16:14:04 +00:00
src Bug 1490496 - implement XPCOM FFI for key-value storage r=nika,lina,mossop 2019-02-07 16:14:04 +00:00
.cargo-checksum.json Bug 1490496 - implement XPCOM FFI for key-value storage r=nika,lina,mossop 2019-02-07 16:14:04 +00:00
CODEOWNERS
CODE_OF_CONDUCT.md Bug 1490496 - implement XPCOM FFI for key-value storage r=nika,lina,mossop 2019-02-07 16:14:04 +00:00
CONTRIBUTING.md
COPYRIGHT
Cargo.toml Bug 1490496 - implement XPCOM FFI for key-value storage r=nika,lina,mossop 2019-02-07 16:14:04 +00:00
LICENSE-APACHE
LICENSE-MIT
README.md Bug 1490496 - implement XPCOM FFI for key-value storage r=nika,lina,mossop 2019-02-07 16:14:04 +00:00

README.md

uuid

Build Status Appveyor Status Latest Version Join the chat at https://gitter.im/uuid-rs/Lobby Minimum rustc version

A Rust library to 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 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.

Documentation

Usage

Add this to your Cargo.toml:

[dependencies]
uuid = "0.7"

and this to your crate root:

extern crate uuid;

Examples

To parse a simple UUID, then print the version and urn string format:

extern crate uuid;
use uuid::Uuid;

fn main() {
    let my_uuid = Uuid::parse_str("936DA01F9ABD4d9d80C702AF85C822A8").unwrap();
    println!("Parsed a version {} UUID.", my_uuid.get_version_num());
    println!("{}", my_uuid);
}

The library supports 5 versions of UUID:

Name Version
Mac Version 1: MAC address
Dce Version 2: DCE Security
Md5 Version 3: MD5 hash
Random Version 4: Random
Sha1 Version 5: SHA-1 hash

To create a new random (V4) UUID and print it out in hexadecimal form, first you'll need to change how you depend on uuid:

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

Next, you'll write:

extern crate uuid;
use uuid::Uuid;

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

To create a new sha1-hash based (V5) UUID and print it out in hexadecimal form, you'll also need to change how you depend on uuid:

[dependencies]
uuid = { version = "0.7", features = ["v5"] }

Next, you'll write:

extern crate uuid;
use uuid::Uuid;

fn main() {
    let my_uuid = Uuid::new_v5(&Uuid::NAMESPACE_DNS, "foo".as_bytes());
    println!("{}", my_uuid);
}

References

Wikipedia: Universally Unique Identifier