import { type AsyncStream } from "https://deno.land/x/rimbu@0.13.1/core/mod.ts";
const { NonEmpty } = AsyncStream;
A non-empty and possibly infinite asynchronous sequence of elements of type T. See the Stream documentation and the AsyncStream API documentation
Examples
Example 1
Example 1
const s1 = AsyncStream.empty<number>()
const s2 = AsyncStream.of(1, 3, 2)
const s3 = AsyncStream.from(Stream.range({ start: 10, amount: 15 }))
Methods
Returns this collection typed as a 'possibly empty' collection.
Returns a non-empty AsyncStream where each element in this stream is paired with its index
Returns a non-empty AsyncStream where mapFun
is applied to each element.
Returns a non-empty AsyncStream where the given mapFun
is applied to each value in the stream, with optionally
as extra arguments the given args
.
Returns an AsyncStream consisting of the concatenation of flatMapFun
applied to each element.
Returns an AsyncStream consisting of the concatenation of flatMapFun
applied to each element, zipped with the element that was provided to the function.
Returns an AsyncStream consisting of the concatenation of AsyncStreamSource elements resulting from applying the given reducer
to each element.
Returns the first element of the AsyncStream.
Returns the last element of the AsyncStream.
Returns a non-empty AsyncStream that returns the elements from this stream given amount
of times.
Returns a non-empty AsyncStream containing the elements of this stream followed by all elements produced by the others
array of AsyncStreamSources.
Returns the mimimum element of the AsyncStream according to a default compare function.
Returns the mimimum element of the AsyncStream according to the provided compare
function.
Returns the maximum element of the AsyncStream according to a default compare function.
Returns the maximum element of the AsyncStream according to the provided compare
function.
Returns a non-empty AsyncStream with all elements from the given sep
AsyncStreamSource between two elements of this stream.
Returns a non-empty AsyncStream starting with options.sep
, then returning the elements of this Stream interspersed with options.sep
, and ending with
options.end
.
Returns a non-empty AsyncStream containing non-repetitive elements of the source stream, where repetitive elements
are compared using the optionally given eq
equality function.
Returns an AsyncStream containing the values resulting from applying the given the given next
function to a current state (initially the given init
value),
and the next stream value, and returning the new state.
Returns a non-empty Array containing all elements in the AsyncStream.
Examples
Example 1
Example 1
const s1 = AsyncStream.empty<number>()
const s2 = AsyncStream.of(1, 3, 2)
const s3 = AsyncStream.from(Stream.range({ start: 10, amount: 15 }))
Methods
Returns this collection typed as a 'possibly empty' collection.
Returns a non-empty AsyncStream where each element in this stream is paired with its index
Returns a non-empty AsyncStream where mapFun
is applied to each element.
Returns a non-empty AsyncStream where the given mapFun
is applied to each value in the stream, with optionally
as extra arguments the given args
.
Returns an AsyncStream consisting of the concatenation of flatMapFun
applied to each element.
Returns an AsyncStream consisting of the concatenation of flatMapFun
applied to each element, zipped with the element that was provided to the function.
Returns an AsyncStream consisting of the concatenation of AsyncStreamSource elements resulting from applying the given reducer
to each element.
Returns the first element of the AsyncStream.
Returns the last element of the AsyncStream.
Returns a non-empty AsyncStream that returns the elements from this stream given amount
of times.
Returns a non-empty AsyncStream containing the elements of this stream followed by all elements produced by the others
array of AsyncStreamSources.
Returns the mimimum element of the AsyncStream according to a default compare function.
Returns the mimimum element of the AsyncStream according to the provided compare
function.
Returns the maximum element of the AsyncStream according to a default compare function.
Returns the maximum element of the AsyncStream according to the provided compare
function.
Returns a non-empty AsyncStream with all elements from the given sep
AsyncStreamSource between two elements of this stream.
Returns a non-empty AsyncStream starting with options.sep
, then returning the elements of this Stream interspersed with options.sep
, and ending with
options.end
.
Returns a non-empty AsyncStream containing non-repetitive elements of the source stream, where repetitive elements
are compared using the optionally given eq
equality function.
Returns an AsyncStream containing the values resulting from applying the given the given next
function to a current state (initially the given init
value),
and the next stream value, and returning the new state.
Returns a non-empty Array containing all elements in the AsyncStream.