mirror of
https://github.com/uuid-rs/uuid.git
synced 2025-09-30 06:21:02 +00:00
print uuids in examples
This commit is contained in:
parent
952f75fb1a
commit
33f6b3edd9
@ -2,14 +2,16 @@
|
|||||||
//!
|
//!
|
||||||
//! If you enable the `v4` feature you can generate random UUIDs.
|
//! If you enable the `v4` feature you can generate random UUIDs.
|
||||||
|
|
||||||
#[test]
|
|
||||||
#[cfg(feature = "v4")]
|
#[cfg(feature = "v4")]
|
||||||
fn generate_random_uuid() {
|
fn main() {
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
let uuid = Uuid::new_v4();
|
let uuid = Uuid::new_v4();
|
||||||
|
|
||||||
assert_eq!(Some(uuid::Version::Random), uuid.get_version());
|
assert_eq!(Some(uuid::Version::Random), uuid.get_version());
|
||||||
|
|
||||||
|
println!("{}", uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "v4"))]
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -2,14 +2,16 @@
|
|||||||
//!
|
//!
|
||||||
//! If you enable the `v7` feature you can generate sortable UUIDs.
|
//! If you enable the `v7` feature you can generate sortable UUIDs.
|
||||||
|
|
||||||
#[test]
|
|
||||||
#[cfg(feature = "v7")]
|
#[cfg(feature = "v7")]
|
||||||
fn generate_sortable_uuid() {
|
fn main() {
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
let uuid = Uuid::now_v7();
|
let uuid = Uuid::now_v7();
|
||||||
|
|
||||||
assert_eq!(Some(uuid::Version::SortRand), uuid.get_version());
|
assert_eq!(Some(uuid::Version::SortRand), uuid.get_version());
|
||||||
|
|
||||||
|
println!("{}", uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "v7"))]
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user