Skip to main content

Table

Trait Table 

Source
pub trait Table<'scope> {
    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<'scope> for (T₁, T₂, …, Tₙ)
where T: Table<'scope>,

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

Source§

type Result = (<T as Table<'scope>>::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<'scope> for One<'scope, ExprMode, A>
where A: Value,

Source§

impl<'scope, A, B> Table<'scope> 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<'scope> 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<'scope> for Expr<'scope, T>
where T: Value,

Source§

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

Source§

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

Source§

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

Source§

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

Source§

type Result = Option<<T as Table<'scope>>::Result>

Source§

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

Source§

type Result = Option<<T as Table<'scope>>::Result>