You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// TQueue.tsdeclareinterfaceTQueue<inoutA>extendsTEnqueue<A>,TDequeue<A>{}/** * The base interface that all `TQueue`s must implement. */interfaceBaseTQueue{/** * Returns the number of elements the queue can hold. */capacity(): number/** * Retrieves the size of the queue, which is equal to the number of elements * in the queue. This may be negative if fibers are suspended waiting for * elements to be added to the queue. */readonlysize: STM.STM<number>/** * Returns `true` if the `TQueue` contains at least one element, `false` * otherwise. */readonlyisFull: STM.STM<boolean>/** * Returns `true` if the `TQueue` contains zero elements, `false` otherwise. */readonlyisEmpty: STM.STM<boolean>/** * Interrupts any fibers that are suspended on `offer` or `take`. Future calls * to `offer*` and `take*` will be interrupted immediately. */readonlyshutdown: STM.STM<void>/** * Returns `true` if `shutdown` has been called, otherwise returns `false`. */readonlyisShutdown: STM.STM<boolean>/** * Waits until the queue is shutdown. The `STM` returned by this method will * not resume until the queue has been shutdown. If the queue is already * shutdown, the `STM` will resume right away. */readonlyawaitShutdown: STM.STM<void>}interfaceTDequeue<outA>extendsTQueue.TDequeueVariance<A>,BaseTQueue{/** * Views the next element in the queue without removing it, retrying if the * queue is empty. */readonlypeek: STM.STM<A>/** * Views the next element in the queue without removing it, returning `None` * if the queue is empty. */readonlypeekOption: STM.STM<Option<A>>/** * Takes the oldest value in the queue. If the queue is empty, this will return * a computation that resumes when an item has been added to the queue. */readonlytake: STM.STM<A>/** * Takes all the values in the queue and returns the values. If the queue is * empty returns an empty collection. */readonlytakeAll: STM.STM<Array<A>>/** * Takes up to max number of values from the queue. */takeUpTo(max: number): STM.STM<Array<A>>}interfaceTEnqueue<inA>extendsTQueue.TEnqueueVariance<A>,BaseTQueue{/** * Places one value in the queue. */offer(value: A): STM.STM<boolean>/** * For Bounded TQueue: uses the `BackPressure` Strategy, places the values in * the queue and always returns true. If the queue has reached capacity, then * the fiber performing the `offerAll` will be suspended until there is room * in the queue. * * For Unbounded TQueue: Places all values in the queue and returns true. * * For Sliding TQueue: uses `Sliding` Strategy If there is room in the queue, * it places the values otherwise it removes the old elements and enqueues the * new ones. Always returns true. * * For Dropping TQueue: uses `Dropping` Strategy, It places the values in the * queue but if there is no room it will not enqueue them and return false. */offerAll(iterable: Iterable<A>): STM.STM<boolean>}