pub trait StreamExt: Stream {
// Provided methods
fn collect_text(self) -> CollectText<Self> ⓘ
where Self: Sized { ... }
fn filter_empty(self) -> FilterEmpty<Self>
where Self: Sized { ... }
fn buffer_chunks(self, duration: Duration) -> BufferChunks<Self>
where Self: Sized { ... }
}Expand description
Extension trait for streams with convenience methods.
Provided Methods§
Sourcefn collect_text(self) -> CollectText<Self> ⓘwhere
Self: Sized,
fn collect_text(self) -> CollectText<Self> ⓘwhere
Self: Sized,
Collect all chunks into a single string.
This method consumes the stream and collects all the delta content from each chunk into a single string.
§Returns
A future that resolves to the complete text or an error
Sourcefn filter_empty(self) -> FilterEmpty<Self>where
Self: Sized,
fn filter_empty(self) -> FilterEmpty<Self>where
Self: Sized,
Filter out chunks with empty delta content.
§Returns
A stream that only yields chunks with non-empty delta content
Sourcefn buffer_chunks(self, duration: Duration) -> BufferChunks<Self>where
Self: Sized,
fn buffer_chunks(self, duration: Duration) -> BufferChunks<Self>where
Self: Sized,
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".