Trait RowStreamExtractExt

Source
pub trait RowStreamExtractExt: Sealed {
    // Required methods
    fn extract<T: ExtractOwned>(self) -> ExtractStream<T>;
    fn extract_mut<T: ExtractOwned>(
        self: Pin<&mut Self>,
    ) -> ExtractStreamMut<'_, T>;
}
Expand description

Extension trait for extracting from a RowStream.

Required Methods§

Source

fn extract<T: ExtractOwned>(self) -> ExtractStream<T>

Turns the RowStream into a Stream over T.

§Examples
#[derive(Columns, Extract)]
struct User {
    id: i32,
    name: String,
}

async fn extract_users(i: RowStream) -> Result<Vec<User>, Error> {
    i.extract().try_collect().await
}
Source

fn extract_mut<T: ExtractOwned>(self: Pin<&mut Self>) -> ExtractStreamMut<'_, T>

§Examples
#[derive(Columns, Extract)]
struct User {
    id: i32,
    name: String,
}

async fn extract_users(i: Pin<&mut RowStream>) -> Result<Vec<User>, Error> {
    i.extract_mut().try_collect().await
}

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 RowStreamExtractExt for RowStream

Implementors§