Skip to main content

DbModel

Trait DbModel 

Source
pub trait DbModel {
    // Required methods
    fn collection_name() -> &'static str;
    fn fields() -> Vec<FieldDef>;
    fn primary_field() -> &'static str;

    // Provided method
    fn indexes() -> Vec<IndexDef> { ... }
}
Expand description

Marker trait for Rust types that map to ModelVault collection records.

Implement via #[derive(DbModel)] from the optional modelvault-derive crate (re-exported by the modelvault facade when the derive feature is enabled).

Required Methods§

Source

fn collection_name() -> &'static str

Source

fn fields() -> Vec<FieldDef>

Source

fn primary_field() -> &'static str

Provided Methods§

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§