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

Function offerAll

packages/effect/src/Queue.ts:762–774  ·  view source on GitHub ↗
(self: Enqueue<A, E>, messages: Iterable<A>)

Source from the content-addressed store, hash-verified

760 * @since 2.0.0
761 */
762export const offerAll = <A, E>(self: Enqueue<A, E>, messages: Iterable<A>): Effect<Array<A>> =>
763 internalEffect.suspend(() => {
764 if (self.state._tag !== "Open") {
765 return internalEffect.succeed(Arr.fromIterable(messages))
766 }
767 const remaining = offerAllUnsafe(self as Queue<A, E>, messages)
768 if (remaining.length === 0) {
769 return core.exitSucceed([])
770 } else if (self.strategy === "dropping") {
771 return internalEffect.succeed(remaining)
772 }
773 return offerRemainingArray(self as Queue<A, E>, remaining)
774 })
775
776/**
777 * Adds multiple messages to the queue synchronously. Returns the remaining messages that

Callers

nothing calls this directly

Calls 3

offerAllUnsafeFunction · 0.85
offerRemainingArrayFunction · 0.85
succeedMethod · 0.45

Tested by

no test coverage detected