Skip to main content

LoadExt

Trait LoadExt 

Source
pub trait LoadExt {
    // Provided methods
    fn load<'e, Idx, E: PgExecutor<'e>>(
        &self,
        executor: E,
    ) -> impl Future<Output = Result<Vec<<Self as RowQuery<Idx>>::Output>>>
       where Self: RowQuery<Idx> { ... }
    fn load_one<'e, Idx, E: PgExecutor<'e>>(
        &self,
        executor: E,
    ) -> impl Future<Output = Result<Option<<Self as RowQuery<Idx>>::Output>>>
       where Self: RowQuery<Idx> { ... }
}
Expand description

load for the rows, load_one for the first of them, and ExecuteExt::execute where there are none to decode. One trait for every row-producing builder keeps the terminal vocabulary tied to what a statement yields rather than to which builder happens to be in hand.

Implemented for every builder, satisfiable by the ones that produce rows: what a builder can’t do is then reported by RowQuery, which says so, rather than by the method not existing — which rustc answers with a list of unsatisfied bounds or, worse, by suggesting Iterator. Not a blanket impl, since load/count/execute are names other traits in a caller’s scope have too. A builder added here needs its three empty impls, or its terminal goes back to reporting nothing.

Provided Methods§

Source

fn load<'e, Idx, E: PgExecutor<'e>>( &self, executor: E, ) -> impl Future<Output = Result<Vec<<Self as RowQuery<Idx>>::Output>>>
where Self: RowQuery<Idx>,

Source

fn load_one<'e, Idx, E: PgExecutor<'e>>( &self, executor: E, ) -> impl Future<Output = Result<Option<<Self as RowQuery<Idx>>::Output>>>
where Self: RowQuery<Idx>,

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<D, Output> LoadExt for DynSelect<D, Output>

Source§

impl<D, Output> LoadExt for SetOp<D, Output>

Source§

impl<D, R: InsertRow> LoadExt for Insert<D, R>

Source§

impl<D, Scope, Sel, Outer> LoadExt for Select<D, Scope, Sel, Outer>

Source§

impl<D, T: Table> LoadExt for Delete<D, T>

Source§

impl<D, T: Table> LoadExt for Update<D, T>

Source§

impl<S, Sel> LoadExt for Returning<S, Sel>

Implementors§