Skip to main content

Entity

Trait Entity 

Source
pub trait Entity {
    type Id: Clone + Eq + Hash + Send + Sync + 'static;

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

A domain object that is identified by its Id, not by its attribute values. Two Entity instances with the same Id represent the same conceptual thing even if their other fields differ.

Required Associated Types§

Source

type Id: Clone + Eq + Hash + Send + Sync + 'static

The identity type. Must be hashable so the framework can index entities in maps (e.g. inside a crate::Repository).

Required Methods§

Source

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

Stable identity of this entity instance.

Implementors§