third_party/rust/uuid/README.md
author Markus Stange <mstange@themasta.com>
Tue, 02 Oct 2018 01:50:56 +0000
changeset 497549 255e04ebe3bd06b1ecdcea2a5a699ffc7fd9920d
parent 497516 00eb79fc9f8ae1a9ad35de97d3eb5ffe9b1108cc
child 518517 466f9c24e749d7b3701b60c5ed424e586634a718
permissions -rw-r--r--
Bug 1457481 - Run mach vendor rust. r=froydnj,erahm Most importantly, this picks up "object" and "goblin" for ELF binary parsing. We only use the ELF code from goblin, so the mach-O parsing code gets eliminated by the linker. Overall, this increases the Android installer size by 20KB. Try pushes for reference: before: https://treeherder.mozilla.org/#/jobs?repo=try&revision=834b56dc5ab3d63a43a32f740ee8212296ac726d&selectedJob=201600899 after: https://treeherder.mozilla.org/#/jobs?repo=try&revision=6983b27e8d3cb715d3b7e6cbd276683f6466e3cc&selectedJob=201600475 installer size: 34524820 -> 34542861 (34.52MB -> 34.54MB) $ mach vendor rust Updating registry `https://github.com/rust-lang/crates.io-index` Adding goblin v0.0.17 Adding memmap v0.6.2 Adding miniz-sys v0.1.10 Adding object v0.10.0 Adding parity-wasm v0.31.3 Adding plain v0.2.3 Adding profiler_helper v0.1.0 (file:///Users/mstange/code/mozilla/tools/profiler/rust-helper) Adding scroll v0.9.1 Adding scroll_derive v0.9.5 Adding syn v0.15.5 Adding thin-vec v0.1.0 Adding uuid v0.6.5 0:30.11 The following files exceed the filesize limit of 102400: third_party/rust/miniz-sys/miniz.c third_party/rust/syn-0.14.6/src/expr.rs third_party/rust/syn-0.14.6/src/gen/fold.rs third_party/rust/syn-0.14.6/src/gen/visit.rs third_party/rust/syn-0.14.6/src/gen/visit_mut.rs The syn dependency is not compiled for goblin, as far as I can tell - it's only needed for the 'syn' feature of scroll_derive, and scroll does not ask for scroll_derive/syn. object -> goblin -> scroll -> scroll_derive -/-> syn But it looks like other versions of syn were already in the tree. Depends on D7021 Differential Revision: https://phabricator.services.mozilla.com/D7023

uuid
====

[![Build Status](https://travis-ci.org/uuid-rs/uuid.svg?branch=master)](https://travis-ci.org/uuid-rs/uuid) 
[![Appveyor Status](https://ci.appveyor.com/api/projects/status/github/uuid-rs/uuid?branch=master&svg=true)](https://ci.appveyor.com/project/KodrAus/uuid) 
[![Latest Version](https://img.shields.io/crates/v/uuid.svg)](https://crates.io/crates/uuid) 
[![Join the chat at https://gitter.im/uuid-rs/Lobby](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/uuid-rs/Lobby?utm_source=badge&utm_medium=badge&utm_content=badge)

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](https://docs.rs/uuid)

## Usage

Add this to your `Cargo.toml`:

```toml
[dependencies]
uuid = "0.6"
```

and this to your crate root:

```rust
extern crate uuid;
```

## Examples

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

```rust
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`:

```toml
[dependencies]
uuid = { version = "0.6", features = ["v4"] }
```

Next, you'll write:

```rust
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`:

```toml
[dependencies]
uuid = { version = "0.6", features = ["v5"] }
```

Next, you'll write:

```rust
extern crate uuid;
use uuid::Uuid;

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

## References

[Wikipedia: Universally Unique Identifier](https://en.wikipedia.org/wiki/Universally_unique_identifier)