Skip to main content

Model

Trait Model 

Source
pub trait Model:
    Entity
    + Clone
    + Send
    + Sync
    + 'static {
    // Provided methods
    fn model_name() -> &'static str { ... }
    fn route_key_name() -> &'static str { ... }
}
Expand description

An entity the framework manages.

Clone is required because lifecycle hooks receive the model by value: a repository hands a copy to the event bus and keeps the original for the write. The clone is skipped entirely when nothing is listening.

Provided Methods§

Source

fn model_name() -> &'static str

The model’s name, for error messages — "Post".

Source

fn route_key_name() -> &'static str

The column route-model binding looks a member up by.

Defaults to the primary key; override to bind by slug or UUID.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl Model for FailedJobRow

Source§

impl Model for JobRow

Source§

impl Model for SessionRow

Implementors§