import { FiberId } from "@effect/core/io/FiberId/definition"; import { HashSet } from "@tsplus/stdlib/collections/HashSet/definition"; import { Effect } from "@effect/core/io/Effect/definition"; import { Exit } from "@effect/core/io/Exit/definition"; import { Chunk } from "@tsplus/stdlib/collections/Chunk/definition"; import { Maybe } from "@tsplus/stdlib/data/Maybe/definition"; import { Ord } from "@tsplus/stdlib/prelude/Ord/definition"; import type { FiberDump } from "@effect/core/io/Fiber/_internal/dump"; import type { FiberStatus } from "@effect/core/io/Fiber/status"; export declare const FiberSym: unique symbol; export type FiberSym = typeof FiberSym; export declare const _E: unique symbol; export type _E = typeof _E; export declare const _A: unique symbol; export type _A = typeof _A; /** * A fiber is a lightweight thread of execution that never consumes more than a * whole thread (but may consume much less, depending on contention and * asynchronicity). Fibers are spawned by forking ZIO effects, which run * concurrently with the parent effect. * * Fibers can be joined, yielding their result to other fibers, or interrupted, * which terminates the fiber, safely releasing all resources. * * @tsplus type effect/core/io/Fiber */ export interface Fiber { readonly [FiberSym]: FiberSym; readonly [_E]: () => E; readonly [_A]: () => A; } export type RealFiber = Fiber.Runtime | Fiber.Synthetic; export declare namespace Fiber { type Runtime = RuntimeFiber; type Synthetic = SyntheticFiber; type Dump = FiberDump; type Status = FiberStatus; interface Descriptor { /** * The unique identifier of the `Fiber`. */ readonly id: FiberId; /** * The status of the `Fiber`. */ readonly status: FiberStatus; /** * The set of fibers attempting to interrupt the fiber or its ancestors. */ readonly interrupters: HashSet; } } /** * @tsplus unify effect/core/io/Fiber */ export declare function unifyFiber>(self: X): Fiber<[ X ] extends [{ [_E]: () => infer E; }] ? E : never, [ X ] extends [{ [_A]: () => infer A; }] ? A : never>; /** * @tsplus type effect/core/io/Fiber.Ops */ export interface FiberOps { $: FiberAspects; } export declare const Fiber: FiberOps; /** * @tsplus type effect/core/io/Fiber.Aspects */ export interface FiberAspects { } /** * @tsplus macro remove */ export declare function realFiber(fiber: Fiber): asserts fiber is RealFiber; export interface BaseFiber extends Fiber { /** * The identity of the fiber. */ readonly id: FiberId; /** * Awaits the fiber, which suspends the awaiting fiber until the result of the * fiber has been determined. */ readonly await: Effect>; /** * Retrieves the immediate children of the fiber. */ readonly children: Effect>>; /** * Inherits values from all `FiberRef` instances into current fiber. This * will resume immediately. */ readonly inheritAll: Effect; /** * Tentatively observes the fiber, but returns immediately if it is not * already done. */ readonly poll: Effect>>; /** * In the background, interrupts the fiber as if interrupted from the * specified fiber. If the fiber has already exited, the returned effect will * resume immediately. Otherwise, the effect will resume when the fiber exits. */ readonly interruptAsFork: (fiberId: FiberId) => Effect; } /** * A runtime fiber that is executing an effect. Runtime fibers have an * identity and a trace. * * @tsplus type effect/core/io/Fiber/Runtime */ export interface RuntimeFiber extends BaseFiber { readonly _tag: "RuntimeFiber"; /** * The identity of the fiber. */ readonly id: FiberId.Runtime; /** * The status of the fiber. */ readonly status: Effect; } /** * A synthetic fiber that is created from a pure value or that combines * existing fibers. * * @tsplus type effect/core/io/Fiber/Synthetic */ export declare class SyntheticFiber implements BaseFiber { readonly id: FiberId; readonly children: Effect>>; readonly inheritAll: Effect; readonly poll: Effect>>; readonly interruptAsFork: (fiberId: FiberId) => Effect; readonly _tag = "SyntheticFiber"; readonly [FiberSym]: FiberSym; readonly [_E]: () => E; readonly [_A]: () => A; readonly await: Effect>; constructor(id: FiberId, _await: Effect>, children: Effect>>, inheritAll: Effect, poll: Effect>>, interruptAsFork: (fiberId: FiberId) => Effect); } /** * @tsplus static effect/core/io/Fiber.Ops Ord * @tsplus location "@effect/core/io/Fiber/definition" */ export declare const ordFiber: Ord>; export declare function makeSynthetic(_: { readonly id: FiberId; readonly await: Effect>; readonly children: Effect>>; readonly inheritAll: Effect; readonly poll: Effect>>; readonly interruptAsFork: (fiberId: FiberId) => Effect; }): Fiber; //# sourceMappingURL=definition.d.ts.map