print uuids in examples

This commit is contained in:
KodrAus 2023-07-17 08:38:54 +10:00
parent 952f75fb1a
commit 33f6b3edd9
2 changed files with 8 additions and 4 deletions

View File

@ -2,14 +2,16 @@
//!
//! If you enable the `v4` feature you can generate random UUIDs.
#[test]
#[cfg(feature = "v4")]
fn generate_random_uuid() {
fn main() {
use uuid::Uuid;
let uuid = Uuid::new_v4();
assert_eq!(Some(uuid::Version::Random), uuid.get_version());
println!("{}", uuid);
}
#[cfg(not(feature = "v4"))]
fn main() {}

View File

@ -2,14 +2,16 @@
//!
//! If you enable the `v7` feature you can generate sortable UUIDs.
#[test]
#[cfg(feature = "v7")]
fn generate_sortable_uuid() {
fn main() {
use uuid::Uuid;
let uuid = Uuid::now_v7();
assert_eq!(Some(uuid::Version::SortRand), uuid.get_version());
println!("{}", uuid);
}
#[cfg(not(feature = "v7"))]
fn main() {}