Trait Table

Source
pub trait Table {
    // Required methods
    fn from_row(row: &Row<'_>) -> Result<Self>
       where Self: Sized;
    fn get(db: &Connection) -> Result<Statement<'_>, TableError>;
    fn extract(
        item: Result<Result<Self, Error>, Error>,
    ) -> Result<Self, TableError>
       where Self: Sized;
}
Expand description

Defines behavior for SQL Table data

Required Methods§

Source

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

Deserializes a single row of data into an instance of the struct that implements this Trait

Source

fn get(db: &Connection) -> Result<Statement<'_>, TableError>

Gets a statement we can execute to iterate over the data in the table

Source

fn extract(item: Result<Result<Self, Error>, Error>) -> Result<Self, TableError>
where Self: Sized,

Extract valid row data while handling both types of query errors

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§