Skip to main content

IdGenerator

Trait IdGenerator 

Source
pub trait IdGenerator<Id>: Send + Sync
where Id: EntityId,
{ // Required method fn generate(&self) -> Id; }
Expand description

Generates new EntityIds, e.g. for a new aggregate.

Required Methods§

Source

fn generate(&self) -> Id

Generates a new id.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<Id> IdGenerator<Id> for FixedIdGenerator<Id>
where Id: EntityId,

Source§

impl<Id> IdGenerator<Id> for UuidV4Generator<Id>
where Id: EntityId + TryFrom<Uuid, Error = Infallible>,

Source§

impl<Id> IdGenerator<Id> for UuidV7Generator<Id>
where Id: EntityId + TryFrom<Uuid, Error = Infallible>,