pub struct UuidGen(/* private fields */);
Expand description
A UUID generator object.
Instances of the UUID generator object are thread-safe to generate UUIDs.
Implementations§
Source§impl UuidGen
impl UuidGen
Sourcepub fn new_with_node(node: u64) -> UuidGen
pub fn new_with_node(node: u64) -> UuidGen
Creates a new UUID generator with custom node information. Note: This object is thread-safe. It is best practice to create and reuse a single object per application.
Sourcepub fn gen_random(&self) -> Uuid
pub fn gen_random(&self) -> Uuid
Generates a new V4 (random) UUID
Sourcepub fn gen_from_time(&self, timestamp: u64) -> Uuid
pub fn gen_from_time(&self, timestamp: u64) -> Uuid
Generates a V1 (time) UUID for the specified time.
§Examples
let generator = UuidGen::default();
let uuid = generator.gen_from_time(1457486866742u64);
Trait Implementations§
impl Send for UuidGen
impl Sync for UuidGen
Auto Trait Implementations§
impl Freeze for UuidGen
impl RefUnwindSafe for UuidGen
impl Unpin for UuidGen
impl UnwindSafe for UuidGen
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more