pub trait RskitStreamExt:
Stream
+ Sized
+ Send
+ 'static{
Show 18 methods
// Provided methods
fn rmap<O, F, Fut>(
self,
f: F,
) -> impl Stream<Item = AppResult<O>> + Send + 'static
where O: Send + 'static,
F: FnMut(Self::Item) -> Fut + Send + 'static,
Fut: Future<Output = AppResult<O>> + Send + 'static { ... }
fn rflatmap<O, F, Fut, St>(
self,
f: F,
) -> impl Stream<Item = AppResult<O>> + Send + 'static
where O: Send + 'static,
F: FnMut(Self::Item) -> Fut + Send + 'static,
Fut: Future<Output = AppResult<St>> + Send + 'static,
St: Stream<Item = AppResult<O>> + Send + Unpin + 'static { ... }
fn rfilter<F>(self, f: F) -> impl Stream<Item = Self::Item> + Send + 'static
where F: FnMut(&Self::Item) -> bool + Send + 'static { ... }
fn rdistinct(self) -> impl Stream<Item = Self::Item> + Send + 'static
where Self::Item: Clone + Eq + Hash { ... }
fn rtap<F, Fut>(
self,
f: F,
) -> impl Stream<Item = Self::Item> + Send + 'static
where F: FnMut(&Self::Item) -> Fut + Send + 'static,
Fut: Future<Output = ()> + Send + 'static { ... }
fn rtake(self, n: usize) -> impl Stream<Item = Self::Item> + Send + 'static { ... }
fn rskip(self, n: usize) -> impl Stream<Item = Self::Item> + Send + 'static { ... }
fn rpartition<F>(
self,
predicate: F,
) -> (impl Stream<Item = Self::Item> + Send + 'static, impl Stream<Item = Self::Item> + Send + 'static)
where F: FnMut(&Self::Item) -> bool + Send + 'static { ... }
async fn rreduce<Acc, F>(self, init: Acc, f: F) -> Acc
where Acc: Send + 'static,
F: FnMut(Acc, Self::Item) -> Acc + Send + 'static { ... }
fn rparallel<O, F, Fut>(
self,
concurrency: usize,
f: F,
) -> impl Stream<Item = AppResult<O>> + Send + 'static
where O: Send + 'static,
F: Fn(Self::Item) -> Fut + Clone + Send + Sync + 'static,
Fut: Future<Output = AppResult<O>> + Send + 'static { ... }
fn rfan_out<O, F, Fut>(
self,
max_branches: usize,
fns: Vec<F>,
) -> impl Stream<Item = AppResult<Vec<O>>> + Send + 'static
where O: Send + 'static,
Self::Item: Clone,
F: Fn(Self::Item) -> Fut + Clone + Send + Sync + 'static,
Fut: Future<Output = AppResult<O>> + Send + 'static { ... }
fn rtumbling_window(
self,
duration: Duration,
max_items: usize,
) -> impl Stream<Item = Vec<Self::Item>> + Send + 'static { ... }
fn rsliding_window(
self,
size: usize,
step: usize,
) -> impl Stream<Item = Vec<Self::Item>> + Send + 'static
where Self::Item: Clone { ... }
fn rbatch(
self,
size: usize,
timeout: Duration,
) -> impl Stream<Item = Vec<Self::Item>> + Send + 'static { ... }
fn rdebounce(
self,
delay: Duration,
) -> impl Stream<Item = Self::Item> + Send + 'static { ... }
fn rdebounce_batch(
self,
quiet: Duration,
max_items: usize,
) -> impl Stream<Item = Vec<Self::Item>> + Send + 'static { ... }
fn rthrottle(
self,
interval: Duration,
) -> impl Stream<Item = Self::Item> + Send + 'static { ... }
fn rmerge(
self,
other: impl Stream<Item = Self::Item> + Send + 'static,
) -> impl Stream<Item = Self::Item> + Send + 'static { ... }
}Expand description
Extension trait adding rskit-specific operators to any Stream.
Imported with use rskit_stream::RskitStreamExt;.
Provided Methods§
Sourcefn rmap<O, F, Fut>(
self,
f: F,
) -> impl Stream<Item = AppResult<O>> + Send + 'static
fn rmap<O, F, Fut>( self, f: F, ) -> impl Stream<Item = AppResult<O>> + Send + 'static
Async map — apply a fallible async function to each item.
Sourcefn rflatmap<O, F, Fut, St>(
self,
f: F,
) -> impl Stream<Item = AppResult<O>> + Send + 'static
fn rflatmap<O, F, Fut, St>( self, f: F, ) -> impl Stream<Item = AppResult<O>> + Send + 'static
Async flat-map — apply a function that returns a stream and flatten one level.
Sourcefn rfilter<F>(self, f: F) -> impl Stream<Item = Self::Item> + Send + 'static
fn rfilter<F>(self, f: F) -> impl Stream<Item = Self::Item> + Send + 'static
Keep only items that satisfy the (synchronous) predicate.
Sourcefn rdistinct(self) -> impl Stream<Item = Self::Item> + Send + 'static
fn rdistinct(self) -> impl Stream<Item = Self::Item> + Send + 'static
Emit only the first occurrence of each item.
Sourcefn rtap<F, Fut>(self, f: F) -> impl Stream<Item = Self::Item> + Send + 'static
fn rtap<F, Fut>(self, f: F) -> impl Stream<Item = Self::Item> + Send + 'static
Side-effect for each item — does not modify the stream.
Sourcefn rtake(self, n: usize) -> impl Stream<Item = Self::Item> + Send + 'static
fn rtake(self, n: usize) -> impl Stream<Item = Self::Item> + Send + 'static
Take the first n items from the stream.
Sourcefn rskip(self, n: usize) -> impl Stream<Item = Self::Item> + Send + 'static
fn rskip(self, n: usize) -> impl Stream<Item = Self::Item> + Send + 'static
Skip the first n items from the stream.
Sourcefn rpartition<F>(
self,
predicate: F,
) -> (impl Stream<Item = Self::Item> + Send + 'static, impl Stream<Item = Self::Item> + Send + 'static)
fn rpartition<F>( self, predicate: F, ) -> (impl Stream<Item = Self::Item> + Send + 'static, impl Stream<Item = Self::Item> + Send + 'static)
Split the stream into (matching, remainder) streams.
Sourceasync fn rreduce<Acc, F>(self, init: Acc, f: F) -> Acc
async fn rreduce<Acc, F>(self, init: Acc, f: F) -> Acc
Fold the entire stream into a single value.
Sourcefn rparallel<O, F, Fut>(
self,
concurrency: usize,
f: F,
) -> impl Stream<Item = AppResult<O>> + Send + 'static
fn rparallel<O, F, Fut>( self, concurrency: usize, f: F, ) -> impl Stream<Item = AppResult<O>> + Send + 'static
Process up to concurrency items in parallel (unordered output).
Sourcefn rfan_out<O, F, Fut>(
self,
max_branches: usize,
fns: Vec<F>,
) -> impl Stream<Item = AppResult<Vec<O>>> + Send + 'static
fn rfan_out<O, F, Fut>( self, max_branches: usize, fns: Vec<F>, ) -> impl Stream<Item = AppResult<Vec<O>>> + Send + 'static
Apply multiple functions to the same item and collect all results.
Sourcefn rtumbling_window(
self,
duration: Duration,
max_items: usize,
) -> impl Stream<Item = Vec<Self::Item>> + Send + 'static
fn rtumbling_window( self, duration: Duration, max_items: usize, ) -> impl Stream<Item = Vec<Self::Item>> + Send + 'static
Collect items into non-overlapping windows bounded by time and item count.
Sourcefn rsliding_window(
self,
size: usize,
step: usize,
) -> impl Stream<Item = Vec<Self::Item>> + Send + 'static
fn rsliding_window( self, size: usize, step: usize, ) -> impl Stream<Item = Vec<Self::Item>> + Send + 'static
Emit sliding windows of size items, advancing by step items each time.
Sourcefn rbatch(
self,
size: usize,
timeout: Duration,
) -> impl Stream<Item = Vec<Self::Item>> + Send + 'static
fn rbatch( self, size: usize, timeout: Duration, ) -> impl Stream<Item = Vec<Self::Item>> + Send + 'static
Emit batches of up to size items or when timeout elapses.
Sourcefn rdebounce(
self,
delay: Duration,
) -> impl Stream<Item = Self::Item> + Send + 'static
fn rdebounce( self, delay: Duration, ) -> impl Stream<Item = Self::Item> + Send + 'static
Emit only when no new item arrives within delay.
Sourcefn rdebounce_batch(
self,
quiet: Duration,
max_items: usize,
) -> impl Stream<Item = Vec<Self::Item>> + Send + 'static
fn rdebounce_batch( self, quiet: Duration, max_items: usize, ) -> impl Stream<Item = Vec<Self::Item>> + Send + 'static
Accumulate items into a batch,
emitting it once quiet elapses with no new item (trailing-edge debounce that keeps every item, not just the last)
or early once max_items accumulate.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".