pub trait StreamBatchExt:
Stream
+ Sized
+ Unpin {
// Provided methods
fn batched(self, window: Duration) -> Batched<Self> { ... }
fn batched_with_capacity(
self,
window: Duration,
max_items: usize,
) -> Batched<Self> { ... }
}Expand description
Adds batched to every Stream.
§Example
use finance_query::streaming::{PriceStream, StreamBatchExt};
use futures::StreamExt;
use std::time::Duration;
let mut batches = PriceStream::subscribe(["AAPL", "NVDA", "TSLA"])
.await?
.batched(Duration::from_millis(250));
while let Some(batch) = batches.next().await {
println!("{} updates in this window", batch.len());
}Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".