aml_sta_341615000 (11423312,com.google.android.go.os.statsd,com.google.android.os.statsd)
Snap for 10453563 from 58feb986aac5677eef643e848b5a7514b233493b to mainline-os-statsd-release

Change-Id: I10f537afec1bd0723ec2b61f1ad6a57b5846ca28
tree: dc8e066a3e752ae6cf16d4c52d08ab7a5d2976e7
  1. benches/
  2. examples/
  3. src/
  4. tests/
  5. .cargo_vcs_info.json
  6. .gitignore
  7. Android.bp
  8. Cargo.toml
  9. Cargo.toml.orig
  10. cargo2android.json
  11. cargo2android_nostd.bp
  12. CODE_OF_CONDUCT.md
  13. CONTRIBUTING.md
  14. COPYRIGHT
  15. LICENSE-APACHE
  16. LICENSE-MIT
  17. METADATA
  18. MODULE_LICENSE_APACHE2
  19. OWNERS
  20. README.md
  21. TEST_MAPPING
README.md

uuid

Latest Version Minimum rustc version Continuous integration

Here's an example of a UUID:

67e55044-10b1-426f-9247-bb680e5fe0c8

A UUID is a unique 128-bit value, stored as 16 octets, and regularly formatted as a hex string in five groups. 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.

Getting started

Add the following to your Cargo.toml:

[dependencies.uuid]
version = "1.3.0"
features = [
    "v4",                # Lets you generate random UUIDs
    "fast-rng",          # Use a faster (but still sufficiently random) RNG
    "macro-diagnostics", # Enable better diagnostics for compile-time UUIDs
]

When you want a UUID, you can generate one:

use uuid::Uuid;

let id = Uuid::new_v4();

If you have a UUID value, you can use its string literal form inline:

use uuid::{uuid, Uuid};

const ID: Uuid = uuid!("67e55044-10b1-426f-9247-bb680e5fe0c8");

You can also parse UUIDs without needing any crate features:

use uuid::{Uuid, Version};

let my_uuid = Uuid::parse_str("67e55044-10b1-426f-9247-bb680e5fe0c8")?;

assert_eq!(Some(Version::Random), my_uuid.get_version());

If you'd like to parse UUIDs really fast, check out the uuid-simd library.

For more details on using uuid, see the library documentation.

Minimum Supported Rust Version (MSRV)

The minimum supported Rust version for uuid is documented in CI. It may be bumped in minor releases as necessary.

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.