Class AsyncFlow<T>
- Namespace
- PatternKit.Behavioral.Iterator
- Assembly
- PatternKit.Core.dll
Async counterpart to Flow<T> built on IAsyncEnumerable<T>. Provides Map / Filter / FlatMap / Tee and a replayable Share() that allows multiple forks to enumerate without re-running upstream side-effects.
public sealed class AsyncFlow<T> : IAsyncEnumerable<T>
Type Parameters
T
- Inheritance
-
AsyncFlow<T>
- Implements
- Inherited Members
- Extension Methods
Methods
Filter(Func<T, bool>)
public AsyncFlow<T> Filter(Func<T, bool> predicate)
Parameters
Returns
- AsyncFlow<T>
FlatMap<TOut>(Func<T, IAsyncEnumerable<TOut>>)
public AsyncFlow<TOut> FlatMap<TOut>(Func<T, IAsyncEnumerable<TOut>> selector)
Parameters
selectorFunc<T, IAsyncEnumerable<TOut>>
Returns
- AsyncFlow<TOut>
Type Parameters
TOut
From(IAsyncEnumerable<T>)
public static AsyncFlow<T> From(IAsyncEnumerable<T> source)
Parameters
sourceIAsyncEnumerable<T>
Returns
- AsyncFlow<T>
GetAsyncEnumerator(CancellationToken)
Returns an enumerator that iterates asynchronously through the collection.
public IAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA CancellationToken that may be used to cancel the asynchronous iteration.
Returns
- IAsyncEnumerator<T>
An enumerator that can be used to iterate asynchronously through the collection.
Map<TOut>(Func<T, TOut>)
public AsyncFlow<TOut> Map<TOut>(Func<T, TOut> selector)
Parameters
selectorFunc<T, TOut>
Returns
- AsyncFlow<TOut>
Type Parameters
TOut
Share()
public SharedAsyncFlow<T> Share()
Returns
Tee(Action<T>)
public AsyncFlow<T> Tee(Action<T> effect)
Parameters
effectAction<T>
Returns
- AsyncFlow<T>