From f59f817784307ecb51bd12f567cf1a0d0aac7703 Mon Sep 17 00:00:00 2001 From: Julio Biason Date: Mon, 25 Jan 2021 10:08:41 -0300 Subject: [PATCH] Testing the uuid crate --- check-uuid/Cargo.lock | 93 ++++++++++++++++++++++++++++++++++++++++++ check-uuid/Cargo.toml | 10 +++++ check-uuid/src/main.rs | 9 ++++ 3 files changed, 112 insertions(+) create mode 100644 check-uuid/Cargo.lock create mode 100644 check-uuid/Cargo.toml create mode 100644 check-uuid/src/main.rs diff --git a/check-uuid/Cargo.lock b/check-uuid/Cargo.lock new file mode 100644 index 0000000..07f8054 --- /dev/null +++ b/check-uuid/Cargo.lock @@ -0,0 +1,93 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + +[[package]] +name = "check-uuid" +version = "0.1.0" +dependencies = [ + "uuid", +] + +[[package]] +name = "getrandom" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "libc" +version = "0.2.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99e85c08494b21a9054e7fe1374a732aeadaff3980b6990b94bfd3a70f690005" + +[[package]] +name = "ppv-lite86" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b" + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom", + "libc", + "rand_chacha", + "rand_core", + "rand_hc", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core", +] + +[[package]] +name = "uuid" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fde2f6a4bea1d6e007c4ad38c6839fa71cbb63b6dbf5b595aa38dc9b1093c11" +dependencies = [ + "rand", +] + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" diff --git a/check-uuid/Cargo.toml b/check-uuid/Cargo.toml new file mode 100644 index 0000000..33b8110 --- /dev/null +++ b/check-uuid/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "check-uuid" +version = "0.1.0" +authors = ["Julio Biason "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +uuid = { version = "0.8", features = ["v4"] } diff --git a/check-uuid/src/main.rs b/check-uuid/src/main.rs new file mode 100644 index 0000000..c2b46ee --- /dev/null +++ b/check-uuid/src/main.rs @@ -0,0 +1,9 @@ +use uuid::Uuid; + +fn main() { + let my_uuid = Uuid::new_v4(); + println!("{}", &my_uuid); + + let (major, _, _, _) = my_uuid.as_fields(); + println!("{:x}", &major); +}