Skip to main content

Table

Trait Table 

Source
pub trait Table {
    type Result;

    // Required methods
    fn visit(&self, f: &mut impl FnMut(&ErasedExpr), mode: VisitTableMode);
    fn visit_mut(
        &mut self,
        f: &mut impl FnMut(&mut ErasedExpr),
        mode: VisitTableMode,
    );
}
Expand description

A trait that represents a database result row.

If you implement Table on your type, you must also implement ForLifetimeTable.

Required Associated Types§

Source

type Result

The value a row of this table has when loaded from the database.

Required Methods§

Source

fn visit(&self, f: &mut impl FnMut(&ErasedExpr), mode: VisitTableMode)

Visit each expr in the table.

The order and number of expressions visited must always remain the same, across: Table::visit, Table::visit_mut, and all methods of MapTable.

Source

fn visit_mut( &mut self, f: &mut impl FnMut(&mut ErasedExpr), mode: VisitTableMode, )

Visit each expr in the table, with a mutable reference.

The order and number of expressions visited must always remain the same, across: Table::visit, Table::visit_mut, and all methods of MapTable.

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.

Implementations on Foreign Types§

Source§

impl<'scope, T> Table for (T₁, T₂, …, Tₙ)
where T: Table,

This trait is implemented for tuples up to 15 items long.

Source§

type Result = (<T as Table>::Result,)

Source§

fn visit(&self, f: &mut impl FnMut(&ErasedExpr), mode: VisitTableMode)

Source§

fn visit_mut( &mut self, f: &mut impl FnMut(&mut ErasedExpr), mode: VisitTableMode, )

Implementors§

Source§

impl<'scope, A> Table for One<'scope, ExprMode, A>
where A: Value,

Source§

impl<'scope, A, B> Table for Two<'scope, ExprMode, A, B>
where A: Value, B: Value,

Source§

type Result = <Two<'scope, ExprMode, A, B> as TableHKT>::InMode<ValueMode>

Source§

impl<'scope, A, B, C> Table for Three<'scope, ExprMode, A, B, C>
where A: Value, B: Value, C: Value,

Source§

type Result = <Three<'scope, ExprMode, A, B, C> as TableHKT>::InMode<ValueMode>

Source§

impl<'scope, T> Table for Expr<'scope, T>
where T: Value,

Source§

impl<'scope, T> Table for TableUsingMapper<T>
where T: Table + MapTable<'scope> + TableHKT<Mode = ExprMode>,

Source§

impl<'scope, T: Table> Table for ListTable<T>

Source§

type Result = Vec<<T as Table>::Result>

Source§

impl<'scope, T: Table> Table for MaybeTable<'scope, T>

Source§

impl<'scope, T: Table> Table for NullTable<'scope, T>