import { type Channel } from "https://deno.land/x/rimbu@1.2.0/channel/main/index.ts";
const { Read } = Channel;
A read-only Channel that can perform blocking reads. This means that a receive
call will block until a message is available.
Methods
The maximum amount of messages the Channel can buffer. If 0, the channel is unbuffered and the communication is synchronous.
Returns true if the channel is closed and there are no message in the buffer (length = 0), false otherwise.
readable(): Channel.Read<T>
Returns the Channel as a readonly Channel.Read instance.
receive<RT>(options: { signal?: AbortSignal | undefined; timeoutMs?: number | undefined; recover: (channelError: Channel.Error) => RT; }): Promise<T | RT>
Returns the next message sent to the Channel. Blocks if there are no messages.
receive(options?: { signal?: AbortSignal | undefined; timeoutMs?: number | undefined; recover?: undefined; }): Promise<T>