Upgrade uuid.

This commit is contained in:
Josh Matthews 2019-06-12 11:34:45 -04:00
parent 09f7b6bf36
commit 7e29852baa
2 changed files with 20 additions and 17 deletions

View file

@ -29,7 +29,7 @@ use std::mem;
use std::rc::Rc;
use std::sync::Mutex;
use std::u64;
use uuid::Uuid;
use uuid::{Builder, Uuid, Variant, Version};
// Slightly annoying having to cast between sizes.
@ -162,5 +162,8 @@ pub fn random<T: Rand>() -> T {
pub fn random_uuid() -> Uuid {
let mut bytes = [0; 16];
thread_rng().fill_bytes(&mut bytes);
Uuid::from_random_bytes(bytes)
Builder::from_bytes(bytes)
.set_variant(Variant::RFC4122)
.set_version(Version::Random)
.build()
}