Skip to main content

IdSource

Trait IdSource 

Source
pub trait IdSource: Send + Sync {
    // Required method
    fn new_id(&self) -> Uuid;

    // Provided method
    fn new_device_id(&self) -> DeviceId { ... }
}
Expand description

The source of new ids, supplied when creating or opening a store.

Required Methods§

Source

fn new_id(&self) -> Uuid

A fresh UUID. Distinct calls must yield distinct ids.

Provided Methods§

Source

fn new_device_id(&self) -> DeviceId

A fresh device id derived from this source, without another randomness source. Every install and restored copy receives a new device id (§10.4).

Uses 62 payload bits from the UUID’s last eight bytes and two from its eighth byte: all 64 are random in UUIDv4 and UUIDv7. The version, variant and UUIDv7 timestamp contribute no bits.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl IdSource for SequentialIds

Available on crate feature test-utils only.
Source§

impl IdSource for UuidIds