Trait Model

Source
pub trait Model {
    const NAME: &'static str;
    const COLUMNS: &'static [&'static str];

    // Required methods
    fn params(&self) -> Vec<&(dyn ToSql + Sync)>;
    fn from_row(row: Row) -> Result<Self>
       where Self: Sized;
    fn get_value(&self, column: &str) -> Option<Value>;
    fn sort_keys() -> Vec<String>;

    // Provided method
    fn cursor(&self) -> Cursor { ... }
}

Required Associated Constants§

Source

const NAME: &'static str

Source

const COLUMNS: &'static [&'static str]

Required Methods§

Source

fn params(&self) -> Vec<&(dyn ToSql + Sync)>

Source

fn from_row(row: Row) -> Result<Self>
where Self: Sized,

Source

fn get_value(&self, column: &str) -> Option<Value>

Source

fn sort_keys() -> Vec<String>

Provided Methods§

Source

fn cursor(&self) -> Cursor

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§