@tsonic/dotnet
Version:
TypeScript type definitions for .NET 10 BCL (Base Class Library)
193 lines (135 loc) • 6.73 kB
TypeScript
// Generated by tsbindgen - Architecture
// Namespace: System.Threading.Channels
// Assembly: System.Threading.Channels
// Branded primitive types are sourced from @tsonic/types
import type { sbyte, byte, short, ushort, int, uint, long, ulong, int128, uint128, half, float, double, decimal, nint, nuint, char } from '@tsonic/types';
// Import support types from @tsonic/types
import type { ptr, ref } from "@tsonic/types";
// Import types from other namespaces
import type { IAsyncEnumerable_1, IComparer_1 } from "../../System.Collections.Generic/internal/index.js";
import type { IDictionary } from "../../System.Collections/internal/index.js";
import type { MethodBase } from "../../System.Reflection/internal/index.js";
import * as System_Runtime_Serialization_Internal from "../../System.Runtime.Serialization/internal/index.js";
import type { ISerializable, SerializationInfo, StreamingContext } from "../../System.Runtime.Serialization/internal/index.js";
import type { Task, ValueTask, ValueTask_1 } from "../../System.Threading.Tasks/internal/index.js";
import type { CancellationToken } from "../../System.Threading/internal/index.js";
import * as System_Internal from "../../System/internal/index.js";
import type { Action_1, Boolean as ClrBoolean, Enum, Exception, IComparable, IConvertible, IFormatProvider, IFormattable, Int32, InvalidOperationException, ISpanFormattable, Object as ClrObject, String as ClrString, Type, TypeCode, Void } from "../../System/internal/index.js";
// CLROf<T> - Maps ergonomic primitives to their CLR types for generic constraints
// This utility is used ONLY in generic type arguments to satisfy CLR interface constraints
// Value positions (parameters, return types) use lowercase primitives for ergonomics
export type CLROf<T> =
T extends sbyte ? System_Internal.SByte :
T extends short ? System_Internal.Int16 :
T extends int ? System_Internal.Int32 :
T extends long ? System_Internal.Int64 :
T extends int128 ? System_Internal.Int128 :
T extends nint ? System_Internal.IntPtr :
T extends byte ? System_Internal.Byte :
T extends ushort ? System_Internal.UInt16 :
T extends uint ? System_Internal.UInt32 :
T extends ulong ? System_Internal.UInt64 :
T extends uint128 ? System_Internal.UInt128 :
T extends nuint ? System_Internal.UIntPtr :
T extends half ? System_Internal.Half :
T extends float ? System_Internal.Single :
T extends double ? System_Internal.Double :
T extends decimal ? System_Internal.Decimal :
T extends char ? System_Internal.Char :
T extends boolean ? System_Internal.Boolean :
T extends string ? System_Internal.String :
T; // Identity fallback for non-primitive types
export enum BoundedChannelFullMode {
wait = 0,
dropNewest = 1,
dropOldest = 2,
dropWrite = 3
}
export interface BoundedChannelOptions$instance extends ChannelOptions {
capacity: int;
fullMode: BoundedChannelFullMode;
}
export const BoundedChannelOptions: {
new(capacity: int): BoundedChannelOptions$instance;
};
export type BoundedChannelOptions = BoundedChannelOptions$instance;
export interface Channel_1$instance<T> extends Channel_2<T, T> {
}
export const Channel_1: {
};
export type Channel_1<T> = Channel_1$instance<T>;
export interface Channel_2$instance<TWrite, TRead> {
readonly reader: ChannelReader_1<TRead>;
readonly writer: ChannelWriter_1<TWrite>;
}
export const Channel_2: {
};
export type Channel_2<TWrite, TRead> = Channel_2$instance<TWrite, TRead>;
export interface ChannelClosedException$instance extends InvalidOperationException {
getObjectData(info: SerializationInfo, context: StreamingContext): void;
}
export const ChannelClosedException: {
new(): ChannelClosedException$instance;
new(message: string): ChannelClosedException$instance;
new(innerException: Exception): ChannelClosedException$instance;
new(message: string, innerException: Exception): ChannelClosedException$instance;
};
export interface __ChannelClosedException$views {
As_ISerializable(): System_Runtime_Serialization_Internal.ISerializable$instance;
}
export type ChannelClosedException = ChannelClosedException$instance & __ChannelClosedException$views;
export interface ChannelOptions$instance {
allowSynchronousContinuations: boolean;
singleReader: boolean;
singleWriter: boolean;
}
export const ChannelOptions: {
};
export type ChannelOptions = ChannelOptions$instance;
export interface ChannelReader_1$instance<T> {
readonly canCount: boolean;
readonly canPeek: boolean;
readonly completion: Task;
readonly count: int;
readAllAsync(cancellationToken?: CancellationToken): IAsyncEnumerable_1<T>;
readAsync(cancellationToken?: CancellationToken): ValueTask_1<T>;
tryPeek(item: { value: ref<T> }): boolean;
tryRead(item: { value: ref<T> }): boolean;
waitToReadAsync(cancellationToken?: CancellationToken): ValueTask_1<CLROf<boolean>>;
}
export const ChannelReader_1: {
};
export type ChannelReader_1<T> = ChannelReader_1$instance<T>;
export interface ChannelWriter_1$instance<T> {
complete(error?: Exception): void;
tryComplete(error?: Exception): boolean;
tryWrite(item: T): boolean;
waitToWriteAsync(cancellationToken?: CancellationToken): ValueTask_1<CLROf<boolean>>;
writeAsync(item: T, cancellationToken?: CancellationToken): ValueTask;
}
export const ChannelWriter_1: {
};
export type ChannelWriter_1<T> = ChannelWriter_1$instance<T>;
export interface UnboundedChannelOptions$instance extends ChannelOptions {
}
export const UnboundedChannelOptions: {
new(): UnboundedChannelOptions$instance;
};
export type UnboundedChannelOptions = UnboundedChannelOptions$instance;
export interface UnboundedPrioritizedChannelOptions_1$instance<T> extends ChannelOptions {
comparer: IComparer_1<T>;
}
export const UnboundedPrioritizedChannelOptions_1: {
new<T>(): UnboundedPrioritizedChannelOptions_1$instance<T>;
};
export type UnboundedPrioritizedChannelOptions_1<T> = UnboundedPrioritizedChannelOptions_1$instance<T>;
export abstract class Channel$instance {
static createBounded<T>(capacity: int): Channel_1<T>;
static createBounded<T>(options: BoundedChannelOptions, itemDropped: Action_1<T>): Channel_1<T>;
static createBounded<T>(options: BoundedChannelOptions): Channel_1<T>;
static createUnbounded<T>(): Channel_1<T>;
static createUnbounded<T>(options: UnboundedChannelOptions): Channel_1<T>;
static createUnboundedPrioritized<T>(): Channel_1<T>;
static createUnboundedPrioritized<T>(options: UnboundedPrioritizedChannelOptions_1<T>): Channel_1<T>;
}
export type Channel = Channel$instance;