1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
use auto_impl::auto_impl;
use uuid::Uuid;

/// Infinite UUID generator
#[auto_impl(&, Arc)]
pub trait UuidGenerator: Send + Sync {
  fn next(&self) -> Uuid;
}
pub struct Uuid4Generator;

impl UuidGenerator for Uuid4Generator {
  fn next(&self) -> Uuid {
    uuid::Uuid::new_v4()
  }
}

#[cfg(feature = "neon")]
impl neon::prelude::Finalize for Uuid4Generator {}