Skip to main content

Entity

Trait Entity 

Source
pub trait Entity {
    type Id: Debug + Clone + PartialEq + Eq + Hash + Send + Sync;

    // Required method
    fn id(&self) -> Self::Id;
}
Expand description

Marker trait for domain entities managed by a repository.

Implementors must specify an Id type used to uniquely identify each entity and provide an accessor to retrieve it.

Required Associated Types§

Source

type Id: Debug + Clone + PartialEq + Eq + Hash + Send + Sync

The type used to uniquely identify this entity.

Required Methods§

Source

fn id(&self) -> Self::Id

Returns the unique identifier of this entity.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§