Hyperlinkv0.8.0-beta.28

PubSub

PubSub.capacityconsteffect/PubSub.ts:572
<A>(self: PubSub<A>): number

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
})
getters
Source effect/PubSub.ts:5721 lines
export const capacity = <A>(self: PubSub<A>): number => self.pubsub.capacity