Package: effect
Module: PubSub
Returns the number of elements the queue can hold.
Example (Getting PubSub capacity)
import { Effect, PubSub } from "effect"
const program = Effect.gen(function*() {
const pubsub = yield* PubSub.bounded<string>(100)
const cap = PubSub.capacity(pubsub)
console.log("PubSub capacity:", cap) // 100
const unboundedPubsub = yield* PubSub.unbounded<string>()
const unboundedCap = PubSub.capacity(unboundedPubsub)
console.log("Unbounded capacity:", unboundedCap) // Number.MAX_SAFE_INTEGER
})
Signature
declare const capacity: <A>(self: PubSub<A>) => number
Since v2.0.0