Skip to main content

Entity

Trait Entity 

Source
pub trait Entity: TeaqlEntity + Sized {
    // Required methods
    fn from_record(record: Record) -> Result<Self, EntityError>;
    fn into_record(self) -> Record;

    // Provided methods
    fn on_loaded(&mut self, context: &dyn Any) { ... }
    fn into_json(self) -> Value { ... }
}

Required Methods§

Provided Methods§

Source

fn on_loaded(&mut self, context: &dyn Any)

Invoked immediately after the entity is loaded from the repository. Used by implementations to attach runtime contexts or initialize internal states.

Source

fn into_json(self) -> Value

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§