Skip to main content

Entity

Trait Entity 

Source
pub trait Entity: Debug + Clone {
    type Id: Debug + Clone + PartialEq;

    // Required methods
    fn entity_id(&self) -> &Self::Id;
    fn entity_type() -> &'static str;
}
Expand description

Trait for domain entities

All generated entities implement this trait, providing a common interface for working with domain objects.

Required Associated Types§

Source

type Id: Debug + Clone + PartialEq

The type of the entity’s unique identifier

Required Methods§

Source

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

Get the entity’s unique identifier

Source

fn entity_type() -> &'static str

Get the entity type name

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§