import { Queue, Dequeue } from "@effect/core/io/Queue/definition/common"; import { ExecutionStrategy } from "@effect/core/io/ExecutionStrategy/definition"; import { Fiber } from "@effect/core/io/Fiber/definition"; import { Exit } from "@effect/core/io/Exit/definition"; import { ReleaseMap } from "@effect/core/io/Scope/ReleaseMap/definition"; import { MutableQueue } from "@tsplus/stdlib/collections/mutable/MutableQueue/definition"; import { Deferred } from "@effect/core/io/Deferred/definition"; import { AtomicBoolean } from "@tsplus/stdlib/data/AtomicBoolean"; import { EmptyMutableQueue } from "@tsplus/stdlib/collections/mutable/MutableQueue"; import { Effect } from "@effect/core/io/Effect/definition/base"; import type { Strategy } from "@effect/core/io/Queue/operations/strategy"; import { Chunk } from "@tsplus/stdlib/collections/Chunk"; import type { Collection } from "@tsplus/stdlib/collections/Collection"; import { Maybe } from "@tsplus/stdlib/data/Maybe"; /** * Applies the function `f` to each element of the `Collection` and returns * the results in a new `Chunk`. * * For a parallel version of this method, see `forEachPar`. If you do not need * the results, see `forEachDiscard` for a more efficient implementation. * @tsplus static effect/core/io/Effect.Ops forEach * @tsplus location "@effect/core/io/Effect/operations/excl-forEach" */ export declare function forEach(as: Collection, f: (a: A) => Effect): Effect>; /** * Same as `forEach`, except that the function `f` is supplied * a second argument that corresponds to the index (starting from 0) * of the current element being iterated over. * @tsplus static effect/core/io/Effect.Ops forEachWithIndex * @tsplus location "@effect/core/io/Effect/operations/excl-forEach" */ export declare function forEachWithIndex(as: Collection, f: (a: A, i: number) => Effect): Effect>; /** * Applies the function `f` to each element of the `Collection` and runs * produced effects sequentially. * * Equivalent to `unit(forEach(as, f))`, but without the cost of building * the list of results. * @tsplus static effect/core/io/Effect.Ops forEachDiscard * @tsplus location "@effect/core/io/Effect/operations/excl-forEach" */ export declare function forEachDiscard(as: Collection, f: (a: A) => Effect): Effect; /** * Applies the function `f` to each element of the `Collection` in parallel, * and returns the results in a new `Chunk`. * * For a sequential version of this method, see `forEach`. * @tsplus static effect/core/io/Effect.Ops forEachPar * @tsplus location "@effect/core/io/Effect/operations/excl-forEach" */ export declare function forEachPar(as: Collection, f: (a: A) => Effect): Effect>; /** * Same as `forEachPar`, except that the function `f` is supplied * a second argument that corresponds to the index (starting from 0) * of the current element being iterated over. * @tsplus static effect/core/io/Effect.Ops forEachParWithIndex * @tsplus location "@effect/core/io/Effect/operations/excl-forEach" */ export declare function forEachParWithIndex(as: Collection, f: (a: A, i: number) => Effect): Effect>; /** * Applies the function `f` to each element of the `Collection` and runs * produced effects in parallel, discarding the results. * * For a sequential version of this method, see `forEachDiscard`. * * Optimized to avoid keeping full tree of effects, so that method could be * able to handle large input sequences. Additionally, interrupts all effects * on any failure. * @tsplus static effect/core/io/Effect.Ops forEachParDiscard * @tsplus location "@effect/core/io/Effect/operations/excl-forEach" */ export declare function forEachParDiscard(as: Collection, f: (a: A) => Effect): Effect; /** * Applies the function `f` to each element of the `Collection` and returns * the result in a new `Chunk` using the specified execution strategy. * @tsplus static effect/core/io/Effect.Ops forEachExec * @tsplus location "@effect/core/io/Effect/operations/excl-forEach" */ export declare function forEachExec(as: Collection, f: (a: A) => Effect, strategy: ExecutionStrategy): Effect>; /** * Evaluate each effect in the structure from left to right, and collect the * results. For a parallel version, see `collectAllPar`. * @tsplus static effect/core/io/Effect.Ops collectAll * @tsplus location "@effect/core/io/Effect/operations/excl-forEach" */ export declare function collectAll(as: Collection>): Effect>; /** * Evaluate each effect in the structure in parallel, and collect the * results. For a sequential version, see `collectAll`. * @tsplus static effect/core/io/Effect.Ops collectAllPar * @tsplus location "@effect/core/io/Effect/operations/excl-forEach" */ export declare function collectAllPar(as: Collection>): Effect>; /** * Evaluate each effect in the structure from left to right, and discard the * results. For a parallel version, see `collectAllParDiscard`. * @tsplus static effect/core/io/Effect.Ops collectAllDiscard * @tsplus location "@effect/core/io/Effect/operations/excl-forEach" */ export declare function collectAllDiscard(as: Collection>): Effect; /** * Evaluate each effect in the structure in parallel, and discard the * results. For a sequential version, see `collectAllDiscard`. * @tsplus static effect/core/io/Effect.Ops collectAllParDiscard * @tsplus location "@effect/core/io/Effect/operations/excl-forEach" */ export declare function collectAllParDiscard(as: Collection>): Effect; /** * Evaluate each effect in the structure with `collectAll`, and collect * the results with given partial function. * @tsplus static effect/core/io/Effect.Ops collectAllWith * @tsplus location "@effect/core/io/Effect/operations/excl-forEach" */ export declare function collectAllWith(as: Collection>, pf: (a: A) => Maybe): Effect>; /** * Evaluate each effect in the structure with `collectAll`, and collect * the results with given partial function. * @tsplus static effect/core/io/Effect.Ops collectAllWithPar * @tsplus location "@effect/core/io/Effect/operations/excl-forEach" */ export declare function collectAllWithPar(as: Collection>, pf: (a: A) => Maybe): Effect>; /** * Returns a filtered, mapped subset of the elements of this chunk based on a * partial function. * @tsplus static effect/core/io/Effect.Ops collectAllWithEffect * @tsplus location "@effect/core/io/Effect/operations/excl-forEach" */ export declare function collectAllWithEffect(self: Collection, f: (a: A) => Maybe>): Effect>; /** * Evaluate and run each effect in the structure and collect discarding failed ones. * @tsplus static effect/core/io/Effect.Ops collectAllSuccesses * @tsplus location "@effect/core/io/Effect/operations/excl-forEach" */ export declare function collectAllSuccesses(as: Collection>): Effect>; /** * Evaluate and run each effect in the structure in parallel, and collect discarding failed ones. * @tsplus static effect/core/io/Effect.Ops collectAllSuccessesPar * @tsplus location "@effect/core/io/Effect/operations/excl-forEach" */ export declare function collectAllSuccessesPar(as: Collection>): Effect>; /** * Joins all fibers, awaiting their _successful_ completion. * Attempting to join a fiber that has erred will result in * a catchable error, _if_ that error does not result from interruption. */ export declare function fiberJoinAll(as: Collection>): Effect>; /** * Awaits on all fibers to be completed, successfully or not. */ export declare function fiberWaitAll(as: Collection>): Effect>>; /** * Releases all the finalizers in the releaseMap according to the ExecutionStrategy. */ export declare function releaseMapReleaseAll(self: ReleaseMap, ex: Exit, execStrategy: ExecutionStrategy): Effect; export declare function makeBoundedQueue(requestedCapacity: number): Effect>; export declare function createQueue(queue: MutableQueue, strategy: Strategy): Effect>; export declare function unsafeCreateQueue(queue: MutableQueue, takers: MutableQueue>, shutdownHook: Deferred, shutdownFlag: AtomicBoolean, strategy: Strategy): Queue; export declare function makeBackPressureStrategy(): BackPressureStrategy; export declare class BackPressureStrategy implements Strategy { /** * - `A` is an item to add * - `Deferred` is the deferred completing the whole `offerAll` * - `boolean` indicates if it's the last item to offer (deferred should be * completed once this item is added) */ private putters; handleSurplus(as: Chunk, queue: MutableQueue, takers: MutableQueue>, isShutdown: AtomicBoolean): Effect; unsafeRemove(deferred: Deferred): void; unsafeOffer(as: Chunk, deferred: Deferred): void; unsafeOnQueueEmptySpace(queue: MutableQueue, takers: MutableQueue>): void; get surplusSize(): number; get shutdown(): Effect; } //# sourceMappingURL=excl-forEach.d.ts.map