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

Function clear

packages/effect/src/Queue.ts:1194–1205  ·  view source on GitHub ↗
(self: Dequeue<A, E>)

Source from the content-addressed store, hash-verified

1192 * @since 4.0.0
1193 */
1194export const clear = <A, E>(self: Dequeue<A, E>): Effect<Array<A>, Pull.ExcludeDone<E>> =>
1195 internalEffect.suspend(() => {
1196 if (self.state._tag === "Done") {
1197 if (Pull.isDoneCause(self.state.exit.cause)) {
1198 return internalEffect.succeed([])
1199 }
1200 return self.state.exit
1201 }
1202 const messages = takeAllUnsafe(self)
1203 releaseCapacity(self)
1204 return internalEffect.succeed(messages)
1205 })
1206
1207/**
1208 * Takes all currently available messages, waiting until at least one message

Callers

nothing calls this directly

Calls 3

takeAllUnsafeFunction · 0.85
releaseCapacityFunction · 0.85
succeedMethod · 0.45

Tested by

no test coverage detected