Skip to main content

package @rimbu/stream/async-custom

The @rimbu/stream/async-custom entry exposes custom constructors, utilities, async fast‑iterator support and internal AsyncStream implementations used by the main async stream API in @rimbu/stream/async. Use it only when you need low‑level integration with async fast iterators or to build specialized async stream sources; for normal async pipelines prefer @rimbu/stream/async.

Interfaces

NameDescription
AsyncStreamConstructorsAn interface describing all factory functions used to create AsyncStream instances. Implementations of this interface are exposed via the global AsyncStream value and the @rimbu/stream/async-custom sub-package.

Classes

NameDescription
AsyncAppendIteratorundocumented
AsyncCollectIteratorundocumented
AsyncConcatIteratorundocumented
AsyncDropIteratorundocumented
AsyncDropWhileIteratorundocumented
AsyncFastIteratorBaseBase class for asynchronous fast iterators that implements next in terms of fastNext. Subclasses only need to implement the fastNext method.
AsyncFilterIteratorundocumented
AsyncFilterPureIteratorundocumented
AsyncFromStreamundocumented
AsyncIndexedIteratorundocumented
AsyncMapIteratorundocumented
AsyncMapPureIteratorundocumented
AsyncOfIteratorundocumented
AsyncOfStreamundocumented
AsyncPrependIteratorundocumented
AsyncReduceIteratorundocumented
AsyncRepeatIteratorundocumented
AsyncStreamBaseundocumented
AsyncTakeIteratorundocumented
AsyncTransformerFastIteratorundocumented
AsyncTransformerStreamundocumented
AsyncUnfoldIteratorundocumented
AsyncZipAllWithItereratorundocumented
AsyncZipWithIteratorundocumented
FromAsyncIteratorundocumented
FromIteratorundocumented
FromPromiseundocumented
FromResourceAn AsyncStream implementation that manages an external resource while streaming values. The resource is opened on first iteration and closed when the stream completes or is disposed.
FromResourceIteratorundocumented
FromSourceAn AsyncStream implementation that wraps an arbitrary AsyncStreamSource. Used internally by fromAsyncStreamSource but also available for advanced use cases.

Functions

asyncStreamSourceToIterator

Converts any AsyncStreamSource into an AsyncFastIterator. This is the low-level entry point used by fromAsyncStreamSource.

Definition

export declare function asyncStreamSourceToIterator<T>(source: AsyncStreamSource<T>, close?: () => MaybePromise<void>): AsyncFastIterator<T>;

Type parameters
NameDescription
Tthe element type

Parameters

NameTypeDescription
sourceAsyncStreamSource<T>the async stream source to convert
close() => MaybePromise<void>optional callback that will be invoked when the iterator is closed

closeIters

undocumented

Definition

export declare function closeIters(...iters: (AsyncIterator<any> |undefined| null)[]): Promise<void>;

Parameters

NameTypeDescription
iters(AsyncIterator<any> |undefined| null)[]

isAsyncFastIterator

Returns true if the given iterator implements the AsyncFastIterator interface.

Definition

export declare function isAsyncFastIterator<T>(iterator: AsyncIterator<T>): iterator is AsyncFastIterator<T>;

Type parameters
NameDescription
T

Parameters

NameTypeDescription
iteratorAsyncIterator<T>the async iterator instance to test

isAsyncStream

undocumented

Definition

export declare function isAsyncStream(obj: any): obj is AsyncStream<any>;

Parameters

NameTypeDescription
objany

isEmptyAsyncStreamSourceInstance

Returns true if the given async stream source is known to be empty. If this function returns false, the source may still be empty; it is simply not known.

Definition

export declare function isEmptyAsyncStreamSourceInstance(source: AsyncStreamSource<any>): boolean;

Parameters

NameTypeDescription
sourceAsyncStreamSource<any>a potential async stream source

Constants

NameDescription
AsyncStreamConstructorsImplDefault implementation of the AsyncStreamConstructors interface. This instance backs the exported AsyncStream value.
emptyAsyncFastIteratorAn AsyncFastIterator that is already exhausted and never yields values. Its fastNext method always resolves to the provided fallback value.
emptyAsyncStreamA shared empty AsyncStream instance used throughout the async stream implementation.
fixedDoneAsyncIteratorResultA frozen IteratorResult that represents the completed asynchronous iterator state. This value is reused to avoid repeated allocations in async iterator implementations.
fromAsyncStreamSourceConverts any AsyncStreamSource into a concrete AsyncStream implementation.