pub struct Merge<F> { /* private fields */ }Expand description
The flow returned by merge.
Trait Implementations§
Auto Trait Implementations§
impl<F> Forget for Merge<F>
impl<F> Freeze for Merge<F>
impl<F> Move for Merge<F>
impl<F> RefUnwindSafe for Merge<F>where
Vec<F>: RefUnwindSafe,
impl<F> Send for Merge<F>
impl<F> Sync for Merge<F>
impl<F> Unpin for Merge<F>
impl<F> UnsafeUnpin for Merge<F>where
Vec<F>: UnsafeUnpin,
impl<F> UnwindSafe for Merge<F>where
Vec<F>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FlowExt for Twhere
T: Flow,
impl<T> FlowExt for Twhere
T: Flow,
Source§fn on_each<F>(self, action: F) -> OnEach<Self, F>
fn on_each<F>(self, action: F) -> OnEach<Self, F>
Runs
action for each value before passing it on.Source§fn on_start<F>(self, action: F) -> OnStart<Self, F>where
F: Fn(),
fn on_start<F>(self, action: F) -> OnStart<Self, F>where
F: Fn(),
Runs
action each time a collection starts — Kotlin’s onStart.Source§fn on_completion<F>(self, action: F) -> OnCompletion<Self, F>
fn on_completion<F>(self, action: F) -> OnCompletion<Self, F>
Runs
action when a collection ends, whether the upstream completed or
the collector was cancelled — Kotlin’s onCompletion.Source§fn start_with(self, first: Self::Item) -> StartWith<Self>
fn start_with(self, first: Self::Item) -> StartWith<Self>
Emits
first before the upstream’s values — Kotlin’s
onStart { emit(first) }.Source§fn scan<A, F>(self, initial: A, step: F) -> Scan<Self, A, F>
fn scan<A, F>(self, initial: A, step: F) -> Scan<Self, A, F>
Accumulates values, emitting
initial and then every intermediate
result — Kotlin’s scan / runningFold.Source§fn filter_map<U, F>(self, transform: F) -> FilterMap<Self, F>
fn filter_map<U, F>(self, transform: F) -> FilterMap<Self, F>
Transforms each value and drops the
Nones — Kotlin’s mapNotNull.Source§fn take(self, count: usize) -> Take<Self>
fn take(self, count: usize) -> Take<Self>
Emits the first
count values, then stops and cancels the upstream.Source§fn take_while<P>(self, predicate: P) -> While<Self, P, Taking>
fn take_while<P>(self, predicate: P) -> While<Self, P, Taking>
Emits values while
predicate holds, then completes and cancels the
upstream — Kotlin’s takeWhile.Source§fn skip_while<P>(self, predicate: P) -> While<Self, P, Skipping>
fn skip_while<P>(self, predicate: P) -> While<Self, P, Skipping>
Ignores values while
predicate holds, then emits every value —
Kotlin’s dropWhile.Source§fn transform<U, F, Fut>(
self,
action: F,
) -> Suspending<Self, F, Transforming<U>, InOrder>
fn transform<U, F, Fut>( self, action: F, ) -> Suspending<Self, F, Transforming<U>, InOrder>
Source§fn transform_while<U, F, Fut>(
self,
action: F,
) -> Suspending<Self, F, TransformingWhile<U>, InOrder>
fn transform_while<U, F, Fut>( self, action: F, ) -> Suspending<Self, F, TransformingWhile<U>, InOrder>
Like
transform, but completes and cancels the
upstream as soon as action returns false — Kotlin’s
transformWhile.Source§fn transform_latest<U, F, Fut>(
self,
action: F,
) -> Suspending<Self, F, Transforming<U>, LatestOnly>
fn transform_latest<U, F, Fut>( self, action: F, ) -> Suspending<Self, F, Transforming<U>, LatestOnly>
Like
transform, but a newer value cancels the
action still running for the previous one — Kotlin’s
transformLatest.Source§fn map_async<F, Fut>(
self,
transform: F,
) -> Suspending<Self, F, Mapping, InOrder>
fn map_async<F, Fut>( self, transform: F, ) -> Suspending<Self, F, Mapping, InOrder>
Transforms each value with a suspending
transform, one value at a
time — Kotlin’s map with a suspend lambda. Read moreSource§fn map_latest<F, Fut>(
self,
transform: F,
) -> Suspending<Self, F, Mapping, LatestOnly>
fn map_latest<F, Fut>( self, transform: F, ) -> Suspending<Self, F, Mapping, LatestOnly>
Like
map_async, but a newer value cancels the
transformation still running for the previous one — Kotlin’s
mapLatest.Source§fn filter_async<F, Fut>(
self,
predicate: F,
) -> Suspending<Self, F, Filtering, InOrder>
fn filter_async<F, Fut>( self, predicate: F, ) -> Suspending<Self, F, Filtering, InOrder>
Keeps the values a suspending
predicate accepts — Kotlin’s filter
with a suspend lambda. The predicate gets a clone of each value.Source§fn filter_map_async<U, F, Fut>(
self,
transform: F,
) -> Suspending<Self, F, FilterMapping, InOrder>
fn filter_map_async<U, F, Fut>( self, transform: F, ) -> Suspending<Self, F, FilterMapping, InOrder>
Transforms each value with a suspending
transform and drops the
Nones — Kotlin’s mapNotNull with a suspend lambda.Source§fn on_each_async<F, Fut>(
self,
action: F,
) -> Suspending<Self, F, Inspecting, InOrder>
fn on_each_async<F, Fut>( self, action: F, ) -> Suspending<Self, F, Inspecting, InOrder>
Runs a suspending
action on a clone of each value before emitting it
— Kotlin’s onEach with a suspend lambda.Source§fn distinct_until_changed(self) -> DistinctUntilChanged<Self, WholeValue>
fn distinct_until_changed(self) -> DistinctUntilChanged<Self, WholeValue>
Drops values equal to the one emitted just before.
Source§fn distinct_until_changed_by<K, F>(
self,
key: F,
) -> DistinctUntilChanged<Self, F>
fn distinct_until_changed_by<K, F>( self, key: F, ) -> DistinctUntilChanged<Self, F>
Drops values whose
key equals the key of the value emitted just
before — Kotlin’s distinctUntilChangedBy.Source§fn with_index(self) -> WithIndex<Self>
fn with_index(self) -> WithIndex<Self>
Pairs every value with its position, counting from zero — Kotlin’s
withIndex.Source§fn running_reduce<R>(self, reducer: R) -> RunningReduce<Self, R>
fn running_reduce<R>(self, reducer: R) -> RunningReduce<Self, R>
Emits the first value, then each value folded into the one emitted
before — Kotlin’s
runningReduce.Source§fn chunked(self, size: usize) -> Chunked<Self>
fn chunked(self, size: usize) -> Chunked<Self>
Groups values into vectors of
size; the last one may be shorter —
Kotlin’s chunked. A size of zero counts as one.Source§fn sample(self, period: Duration) -> Sample<Self>
fn sample(self, period: Duration) -> Sample<Self>
Emits the latest value once per
period, skipping periods without a
new value — Kotlin’s sample. A value still waiting when the
upstream completes is dropped.Source§fn timeout(self, limit: Duration) -> Timeout<Self>
fn timeout(self, limit: Duration) -> Timeout<Self>
Wraps values in
Ok, and emits Err(TimedOut) and completes if the
upstream goes limit without emitting — Kotlin’s timeout.Source§fn on_empty<F, Fut>(self, action: F) -> OnEmpty<Self, F>
fn on_empty<F, Fut>(self, action: F) -> OnEmpty<Self, F>
Runs the suspending
action if the flow completes without emitting,
so it can emit a fallback — Kotlin’s onEmpty.Source§fn debounce(self, timeout: Duration) -> Debounce<Self>
fn debounce(self, timeout: Duration) -> Debounce<Self>
Emits a value only after
timeout passes without a newer one.Source§fn flat_map_latest<G, F>(self, transform: F) -> FlatMap<Self, F>
fn flat_map_latest<G, F>(self, transform: F) -> FlatMap<Self, F>
Maps each value to a flow and emits from the newest one, cancelling the
run of the previous flow — Kotlin’s
flatMapLatest.Source§fn flat_map_concat<G, F>(self, transform: F) -> FlatMap<Self, F>
fn flat_map_concat<G, F>(self, transform: F) -> FlatMap<Self, F>
Maps each value to a flow and emits all of it before taking the next
value — Kotlin’s
flatMapConcat.Source§fn flatten_concat(self) -> Flatten<Self>
fn flatten_concat(self) -> Flatten<Self>
Collects each inner flow in turn — Kotlin’s
flattenConcat.Source§fn flatten_merge(self, concurrency: usize) -> Flatten<Self>
fn flatten_merge(self, concurrency: usize) -> Flatten<Self>
Collects up to
concurrency inner flows at once, emitting their
values as they arrive — Kotlin’s flattenMerge; Kotlin’s default
concurrency is DEFAULT_CONCURRENCY.Source§fn flat_map_merge<G, F>(
self,
concurrency: usize,
transform: F,
) -> FlatMap<Self, F>
fn flat_map_merge<G, F>( self, concurrency: usize, transform: F, ) -> FlatMap<Self, F>
Maps each value to a flow and runs up to
concurrency of them at once,
emitting values as they arrive — Kotlin’s flatMapMerge.Source§fn zip<O, U, F>(self, other: O, combiner: F) -> Zip<Self, O, F>
fn zip<O, U, F>(self, other: O, combiner: F) -> Zip<Self, O, F>
Pairs the n-th value of this flow with the n-th value of
other,
completing when either completes — Kotlin’s zip.Source§fn combine<O, U, F>(self, other: O, combiner: F) -> Combine<Self, O, F>
fn combine<O, U, F>(self, other: O, combiner: F) -> Combine<Self, O, F>
Combines the latest values of both flows once each has emitted.
Source§fn catch<T, E, G, H>(self, handler: H) -> Catch<Self, H>
fn catch<T, E, G, H>(self, handler: H) -> Catch<Self, H>
On the first
Err, stops the upstream and continues with the flow
handler returns for the error — Kotlin’s catch.Source§fn retry<T, E>(
self,
attempts: u32,
) -> RetryWhen<Self, impl Fn(&E, u32) -> Option<Duration> + Clone>
fn retry<T, E>( self, attempts: u32, ) -> RetryWhen<Self, impl Fn(&E, u32) -> Option<Duration> + Clone>
Runs the upstream again after an
Err, up to attempts more times,
and passes the last error on — Kotlin’s retry.Source§fn retry_when<T, E, P>(self, policy: P) -> RetryWhen<Self, P>
fn retry_when<T, E, P>(self, policy: P) -> RetryWhen<Self, P>
Runs the upstream again after an
Err when policy returns a back-off
delay for that error and attempt, and passes the error on when it
returns None — Kotlin’s retryWhen.Source§fn flow_on(self, dispatcher: Dispatcher) -> Buffered<Self>
fn flow_on(self, dispatcher: Dispatcher) -> Buffered<Self>
Source§fn buffer(self, capacity: usize) -> Buffered<Self>
fn buffer(self, capacity: usize) -> Buffered<Self>
Runs the upstream in its own coroutine on the collector’s dispatcher,
letting it get up to
capacity values ahead of a slow collector —
Kotlin’s buffer.Source§fn conflate(self) -> Buffered<Self>
fn conflate(self) -> Buffered<Self>
Runs the upstream in its own coroutine and hands a slow collector only
the newest value — Kotlin’s
conflate.Source§fn state_in<S>(
self,
scope: &S,
started: SharingStarted,
initial: Self::Item,
) -> StateFlow<Self::Item>
fn state_in<S>( self, scope: &S, started: SharingStarted, initial: Self::Item, ) -> StateFlow<Self::Item>
Source§fn state_in_first<S>(self, scope: &S) -> StateInFirst<Self::Item> ⓘ
fn state_in_first<S>(self, scope: &S) -> StateInFirst<Self::Item> ⓘ
Starts this flow in
scope at once and waits for its first value,
then returns a StateFlow that starts from it — Kotlin’s suspending
stateIn(scope). None if the flow completes without emitting.Shares this flow as a hot
SharedFlow that runs in scope and
replays the last replay values to new collectors — Kotlin’s
shareIn. Collectors may fall up to
SHARE_IN_BUFFER values or replay,
whichever is larger, behind; beyond that the upstream waits for them.Source§fn boxed(self) -> BoxFlow<Self::Item>
fn boxed(self) -> BoxFlow<Self::Item>
Erases the type so the flow can sit behind a trait or be stored.
Source§fn boxed_local(self) -> LocalBoxFlow<Self::Item>where
Self: 'static,
Self::Run: 'static,
fn boxed_local(self) -> LocalBoxFlow<Self::Item>where
Self: 'static,
Self::Run: 'static,
Erases the type of a flow that stays on one thread.
Source§fn collect_async<F, Fut>(&self, action: F) -> CollectAsync<Self::Run, F>
fn collect_async<F, Fut>(&self, action: F) -> CollectAsync<Self::Run, F>
Runs the flow, awaiting a suspending
action for every value in turn,
until it completes — Kotlin’s collect with a suspend lambda.Source§fn collect_latest<F, Fut>(&self, action: F) -> CollectLatest<Self::Run, F>
fn collect_latest<F, Fut>(&self, action: F) -> CollectLatest<Self::Run, F>
Runs the flow, cancelling the
action still running for a value as
soon as a newer value arrives — Kotlin’s collectLatest.Source§fn produce_in<S>(&self, scope: &S) -> Receiver<Self::Item>
fn produce_in<S>(&self, scope: &S) -> Receiver<Self::Item>
Collects the flow in
scope into a buffered channel and returns its
receiving end — Kotlin’s produceIn. Dropping every receiver cancels
the collection.Source§fn fold<A, F>(&self, initial: A, step: F) -> Fold<Self::Run, A, F> ⓘ
fn fold<A, F>(&self, initial: A, step: F) -> Fold<Self::Run, A, F> ⓘ
Runs the flow, folding every value into an accumulator that starts at
initial — Kotlin’s fold.Source§fn reduce<F>(&self, reducer: F) -> Reduce<Self::Run, F> ⓘ
fn reduce<F>(&self, reducer: F) -> Reduce<Self::Run, F> ⓘ
Runs the flow, folding every value into the first one;
None for an
empty flow — Kotlin’s reduceOrNull.Source§fn count(&self) -> Count<Self::Run, Self::Item>
fn count(&self) -> Count<Self::Run, Self::Item>
Runs the flow and counts its values — Kotlin’s
count.Source§fn last(&self) -> Last<Self::Run, Self::Item>
fn last(&self) -> Last<Self::Run, Self::Item>
Runs the flow and returns its last value — Kotlin’s
lastOrNull.Source§fn single(&self) -> Single<Self::Run> ⓘ
fn single(&self) -> Single<Self::Run> ⓘ
Returns the flow’s only value, or
None once it turns out to have
none or more than one — Kotlin’s singleOrNull.