Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 19 additions & 31 deletions async/unstable_channel.ts → async/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@ interface ReceiverNode<T> {
* {@linkcode Channel.send}, the `value` property carries the unsent value
* for recovery.
*
* @experimental **UNSTABLE**: New API, yet to be vetted.
*
* @example Usage
* ```ts
* import { Channel, ChannelClosedError } from "@std/async/unstable-channel";
* import { Channel, ChannelClosedError } from "@std/async/channel";
* import { assertInstanceOf } from "@std/assert";
*
* const ch = new Channel<number>();
Expand All @@ -53,7 +51,7 @@ export class ChannelClosedError extends Error {
*
* @example Usage
* ```ts
* import { Channel, ChannelClosedError } from "@std/async/unstable-channel";
* import { Channel, ChannelClosedError } from "@std/async/channel";
* import { assertEquals, assertInstanceOf } from "@std/assert";
*
* const ch = new Channel<number>();
Expand Down Expand Up @@ -97,8 +95,6 @@ export class ChannelClosedError extends Error {
* - `"empty"` — the channel is open but no value is immediately available.
* - `"closed"` — the channel has been closed and no buffered values remain.
*
* @experimental **UNSTABLE**: New API, yet to be vetted.
*
* @typeParam T The type of the value received from the channel.
*/
export type ChannelReceiveResult<T> =
Expand All @@ -108,8 +104,6 @@ export type ChannelReceiveResult<T> =

/**
* Options for the {@linkcode Channel} constructor.
*
* @experimental **UNSTABLE**: New API, yet to be vetted.
*/
export interface ChannelOptions {
/**
Expand All @@ -125,8 +119,6 @@ export interface ChannelOptions {

/**
* Options for {@linkcode Channel.send}.
*
* @experimental **UNSTABLE**: New API, yet to be vetted.
*/
export interface ChannelSendOptions {
/**
Expand All @@ -140,8 +132,6 @@ export interface ChannelSendOptions {

/**
* Options for {@linkcode Channel.receive}.
*
* @experimental **UNSTABLE**: New API, yet to be vetted.
*/
export interface ChannelReceiveOptions {
/**
Expand Down Expand Up @@ -175,11 +165,9 @@ export interface ChannelReceiveOptions {
* and multiple {@linkcode Channel.toReadableStream} instances each
* consume values FIFO; every value is delivered to exactly one consumer.
*
* @experimental **UNSTABLE**: New API, yet to be vetted.
*
* @example Basic producer/consumer
* ```ts
* import { Channel } from "@std/async/unstable-channel";
* import { Channel } from "@std/async/channel";
* import { assertEquals } from "@std/assert";
*
* const ch = new Channel<number>({ capacity: 4 });
Expand All @@ -197,7 +185,7 @@ export interface ChannelReceiveOptions {
*
* @example Using `await using` for automatic cleanup
* ```ts
* import { Channel } from "@std/async/unstable-channel";
* import { Channel } from "@std/async/channel";
* import { assert } from "@std/assert";
*
* let ref: Channel<string>;
Expand Down Expand Up @@ -251,7 +239,7 @@ export class Channel<T>
*
* @example Usage
* ```ts
* import { Channel } from "@std/async/unstable-channel";
* import { Channel } from "@std/async/channel";
* import { assertEquals } from "@std/assert";
*
* const ch = new Channel<number>({ capacity: 1 });
Expand All @@ -262,7 +250,7 @@ export class Channel<T>
*
* @example Cancelling with an AbortSignal
* ```ts
* import { Channel } from "@std/async/unstable-channel";
* import { Channel } from "@std/async/channel";
* import { assertRejects } from "@std/assert";
*
* const ch = new Channel<number>();
Expand Down Expand Up @@ -329,7 +317,7 @@ export class Channel<T>
*
* @example Usage
* ```ts
* import { Channel } from "@std/async/unstable-channel";
* import { Channel } from "@std/async/channel";
* import { assertEquals } from "@std/assert";
*
* const ch = new Channel<number>({ capacity: 1 });
Expand All @@ -340,7 +328,7 @@ export class Channel<T>
*
* @example Cancelling with an AbortSignal
* ```ts
* import { Channel } from "@std/async/unstable-channel";
* import { Channel } from "@std/async/channel";
* import { assertRejects } from "@std/assert";
*
* const ch = new Channel<number>();
Expand Down Expand Up @@ -407,7 +395,7 @@ export class Channel<T>
*
* @example Usage
* ```ts
* import { Channel } from "@std/async/unstable-channel";
* import { Channel } from "@std/async/channel";
* import { assert, assertFalse } from "@std/assert";
*
* const ch = new Channel<number>({ capacity: 1 });
Expand Down Expand Up @@ -435,7 +423,7 @@ export class Channel<T>
*
* @example Usage
* ```ts
* import { Channel } from "@std/async/unstable-channel";
* import { Channel } from "@std/async/channel";
* import { assertEquals } from "@std/assert";
*
* const ch = new Channel<number>({ capacity: 1 });
Expand Down Expand Up @@ -467,7 +455,7 @@ export class Channel<T>
*
* @example Usage
* ```ts
* import { Channel } from "@std/async/unstable-channel";
* import { Channel } from "@std/async/channel";
* import { assert } from "@std/assert";
*
* const ch = new Channel<number>();
Expand All @@ -485,7 +473,7 @@ export class Channel<T>
*
* @example Usage
* ```ts
* import { Channel } from "@std/async/unstable-channel";
* import { Channel } from "@std/async/channel";
* import { assertRejects } from "@std/assert";
*
* const ch = new Channel<number>();
Expand Down Expand Up @@ -525,7 +513,7 @@ export class Channel<T>
*
* @example Usage
* ```ts
* import { Channel } from "@std/async/unstable-channel";
* import { Channel } from "@std/async/channel";
* import { assert, assertFalse } from "@std/assert";
*
* const ch = new Channel<number>();
Expand All @@ -546,7 +534,7 @@ export class Channel<T>
*
* @example Usage
* ```ts
* import { Channel } from "@std/async/unstable-channel";
* import { Channel } from "@std/async/channel";
* import { assertEquals } from "@std/assert";
*
* const ch = new Channel<number>({ capacity: 4 });
Expand All @@ -567,7 +555,7 @@ export class Channel<T>
*
* @example Usage
* ```ts
* import { Channel } from "@std/async/unstable-channel";
* import { Channel } from "@std/async/channel";
* import { assertEquals } from "@std/assert";
*
* const ch = new Channel<number>({ capacity: 8 });
Expand All @@ -586,7 +574,7 @@ export class Channel<T>
*
* @example Usage
* ```ts
* import { Channel } from "@std/async/unstable-channel";
* import { Channel } from "@std/async/channel";
* import { assertEquals } from "@std/assert";
*
* const ch = new Channel<number>({ capacity: 4 });
Expand Down Expand Up @@ -631,7 +619,7 @@ export class Channel<T>
*
* @example Usage
* ```ts
* import { Channel } from "@std/async/unstable-channel";
* import { Channel } from "@std/async/channel";
* import { assertEquals } from "@std/assert";
*
* const ch = new Channel<number>({ capacity: 4 });
Expand Down Expand Up @@ -670,7 +658,7 @@ export class Channel<T>
*
* @example Usage
* ```ts
* import { Channel } from "@std/async/unstable-channel";
* import { Channel } from "@std/async/channel";
* import { assert } from "@std/assert";
*
* const ch = new Channel<number>();
Expand All @@ -688,7 +676,7 @@ export class Channel<T>
*
* @example Usage
* ```ts
* import { Channel } from "@std/async/unstable-channel";
* import { Channel } from "@std/async/channel";
* import { assert } from "@std/assert";
*
* const ch = new Channel<number>();
Expand Down
2 changes: 1 addition & 1 deletion async/unstable_channel_test.ts → async/channel_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
assertRejects,
assertThrows,
} from "@std/assert";
import { Channel, ChannelClosedError } from "./unstable_channel.ts";
import { Channel, ChannelClosedError } from "./channel.ts";

// -- Constructor --

Expand Down
4 changes: 2 additions & 2 deletions async/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"exports": {
".": "./mod.ts",
"./abortable": "./abortable.ts",
"./channel": "./channel.ts",
"./deadline": "./deadline.ts",
"./debounce": "./debounce.ts",
"./delay": "./delay.ts",
Expand All @@ -20,7 +21,6 @@
"./unstable-semaphore": "./unstable_semaphore.ts",
"./unstable-circuit-breaker": "./unstable_circuit_breaker.ts",
"./lazy": "./lazy.ts",
"./unstable-pool-settled": "./unstable_pool_settled.ts",
"./unstable-channel": "./unstable_channel.ts"
"./unstable-pool-settled": "./unstable_pool_settled.ts"
}
}
1 change: 1 addition & 0 deletions async/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

export * from "./abortable.ts";
export * from "./channel.ts";
export * from "./deadline.ts";
export * from "./debounce.ts";
export * from "./delay.ts";
Expand Down
Loading