Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/rimbu/channel/custom/index.ts>Channel.Write

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
interface Channel.Write
import { type Channel } from "https://deno.land/x/rimbu@1.1.0/channel/custom/index.ts";
const { Write } = Channel;

A write-only Channel that can perform blocking writes. This means that a send call will block until the channel has capacity to send a message.

Type Parameters

optional
T = void

Methods

getter
isClosed(): boolean

Returns true if the Channel is closed.

writable(): Channel.Write<T>

Returns the Channel as a write-only Channel.Write instance.

send(value: T, options: { signal?: AbortSignal | undefined; timeoutMs?: number | undefined; catchChannelErrors?: false | undefined; }): Promise<void>

Send the given value message to the Channel. Blocks if the Channel is already at maximum capacity.

send(value: T, options?: { signal?: AbortSignal | undefined; timeoutMs?: number | undefined; catchChannelErrors: boolean; }): Promise<undefined | Channel.Error>
sendAll(source: AsyncStreamSource<T>, options: { signal?: AbortSignal | undefined; timeoutMs?: number | undefined; catchChannelErrors?: false | undefined; }): Promise<void>

Sequentially send all the values in the given source to the channel. Blocks until all the values are sent.

sendAll(source: AsyncStreamSource<T>, options?: { signal?: AbortSignal | undefined; timeoutMs?: number | undefined; catchChannelErrors: boolean; }): Promise<undefined | Channel.Error>
close(): void

Closes the channel. After a close, further send actions will throw.