pub trait StreamApiExt<M: Model> {
// Required methods
fn stream_buffered<'a, 'b: 'a, C: Connection + Send + 'b>(
self,
conn: &'b mut C,
) -> Pin<Box<dyn Stream<Item = Result<RowResult, DbError>> + Send + 'a>>;
fn stream_with_backpressure<'a, 'b: 'a, C: Connection + Send + 'b>(
self,
conn: &'b mut C,
buffer_size: usize,
) -> Result<Pin<Box<dyn Stream<Item = Result<RowResult, DbError>> + Send + 'a>>, DbError>;
}Expand description
Stream API 扩展 trait
为 QueryBuilder<M> 提供 stream_buffered 兼容版方法和 stream_with_backpressure 背压方法。
Required Methods§
Sourcefn stream_buffered<'a, 'b: 'a, C: Connection + Send + 'b>(
self,
conn: &'b mut C,
) -> Pin<Box<dyn Stream<Item = Result<RowResult, DbError>> + Send + 'a>>
fn stream_buffered<'a, 'b: 'a, C: Connection + Send + 'b>( self, conn: &'b mut C, ) -> Pin<Box<dyn Stream<Item = Result<RowResult, DbError>> + Send + 'a>>
兼容版流式查询(全量收集后逐行 yield)
保留 v2.0.0 stream 的行为,作为逃生舱。
推荐使用 stream(真游标,低内存)。
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".