MCPcopy Create free account
hub / github.com/Effect-TS/effect / asyncPush

Function asyncPush

packages/effect/src/internal/stream.ts:615–631  ·  view source on GitHub ↗
(
  register: (emit: Emit.EmitOpsPush<E, A>) => Effect.Effect<unknown, E, R | Scope.Scope>,
  options?: {
    readonly bufferSize: "unbounded"
  } | {
    readonly bufferSize?: number | undefined
    readonly strategy?: "dropping" | "sliding" | undefined
  } | undefined
)

Source from the content-addressed store, hash-verified

613
614/** @internal */
615export const asyncPush = <A, E = never, R = never>(
616 register: (emit: Emit.EmitOpsPush<E, A>) => Effect.Effect<unknown, E, R | Scope.Scope>,
617 options?: {
618 readonly bufferSize: "unbounded"
619 } | {
620 readonly bufferSize?: number | undefined
621 readonly strategy?: "dropping" | "sliding" | undefined
622 } | undefined
623): Stream.Stream<A, E, Exclude<R, Scope.Scope>> =>
624 Effect.acquireRelease(
625 mailboxFromBufferOptionsPush<A, E>(options),
626 (mailbox) => mailbox.shutdown
627 ).pipe(
628 Effect.tap((mailbox) => register(emit.makePush(mailbox))),
629 Effect.map(mailboxToStream),
630 unwrapScoped
631 )
632
633/** @internal */
634export const asyncScoped = <A, E = never, R = never>(

Callers

nothing calls this directly

Calls 4

registerFunction · 0.70
pipeMethod · 0.65
mapMethod · 0.65

Tested by

no test coverage detected