Skip to main content

RowStream

Struct RowStream 

Source
pub struct RowStream<'a> { /* private fields */ }
Expand description

Stream síncrono sobre as linhas de um cursor aberto, criado por Statement::rows. Entrega uma linha por vez via Self::try_next, buscando lotes do servidor sob demanda — não materializa o resultado inteiro.

É um lending iterator (try_next(&mut self)), não um Iterator padrão: como o stream toma &mut Connection emprestado, a conexão fica presa ao cursor enquanto o stream existir. Para a maioria dos usos, o laço while let Some(row) = rows.try_next()? é suficiente; há também Self::try_collect e Self::try_for_each.

Implementations§

Source§

impl RowStream<'_>

Source

pub fn try_next(&mut self) -> Result<Option<Vec<Value>>>

A próxima linha, ou None no fim do cursor.

Source

pub fn next(&mut self) -> Result<Option<Vec<Value>>>

A próxima linha, ou None no fim do cursor.

Prefera Self::try_next em código novo; este método fica como alias compatível para exemplos/código existentes.

Source

pub fn try_collect(self) -> Result<Vec<Vec<Value>>>

Coleta todas as linhas restantes num vetor (equivalente a Statement::fetch_all, mas consumindo o stream).

Source

pub fn try_for_each<F>(self, f: F) -> Result<()>
where F: FnMut(Vec<Value>) -> Result<()>,

Aplica f a cada linha restante, parando no primeiro erro.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for RowStream<'a>

§

impl<'a> !Sync for RowStream<'a>

§

impl<'a> !UnwindSafe for RowStream<'a>

§

impl<'a> Freeze for RowStream<'a>

§

impl<'a> Send for RowStream<'a>

§

impl<'a> Unpin for RowStream<'a>

§

impl<'a> UnsafeUnpin for RowStream<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V