Table of Contents

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

predicate Func<T, bool>

Returns

AsyncFlow<T>

FlatMap<TOut>(Func<T, IAsyncEnumerable<TOut>>)

public AsyncFlow<TOut> FlatMap<TOut>(Func<T, IAsyncEnumerable<TOut>> selector)

Parameters

selector Func<T, IAsyncEnumerable<TOut>>

Returns

AsyncFlow<TOut>

Type Parameters

TOut

From(IAsyncEnumerable<T>)

public static AsyncFlow<T> From(IAsyncEnumerable<T> source)

Parameters

source IAsyncEnumerable<T>

Returns

AsyncFlow<T>

GetAsyncEnumerator(CancellationToken)

Returns an enumerator that iterates asynchronously through the collection.

public IAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A 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

selector Func<T, TOut>

Returns

AsyncFlow<TOut>

Type Parameters

TOut

Share()

public SharedAsyncFlow<T> Share()

Returns

SharedAsyncFlow<T>

Tee(Action<T>)

public AsyncFlow<T> Tee(Action<T> effect)

Parameters

effect Action<T>

Returns

AsyncFlow<T>