StreamTrait

Trait StreamTrait 

Source
pub trait StreamTrait {
    type Stream<'a>: Iterator<Item = Result<QueryResult, DbErr>>
       where Self: 'a;

    // Required methods
    fn get_database_backend(&self) -> DbBackend;
    fn stream_raw<'a>(
        &'a self,
        stmt: Statement,
    ) -> Result<Self::Stream<'a>, DbErr>;

    // Provided method
    fn stream<'a, S: StatementBuilder>(
        &'a self,
        stmt: &S,
    ) -> Result<Self::Stream<'a>, DbErr> { ... }
}
Expand description

Stream query results

Required Associated Types§

Source

type Stream<'a>: Iterator<Item = Result<QueryResult, DbErr>> where Self: 'a

Create a stream for the QueryResult

Required Methods§

Source

fn get_database_backend(&self) -> DbBackend

Get the database backend for the connection. This depends on feature flags enabled.

Source

fn stream_raw<'a>(&'a self, stmt: Statement) -> Result<Self::Stream<'a>, DbErr>

Execute a Statement and return a stream of results

Provided Methods§

Source

fn stream<'a, S: StatementBuilder>( &'a self, stmt: &S, ) -> Result<Self::Stream<'a>, DbErr>

Execute a [QueryStatement] and return a stream of results

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§