Skip to content
Effect Days 2026 Get your ticket

MutableQueue

14 exports Added in v2.0.0 Source

Constructors

bounded

Added in v2.0.0 Source

Creates a new bounded MutableQueue.

Signature

declare function bounded<A>(capacity: number): MutableQueue<A>

unbounded

Added in v2.0.0 Source

Creates a new unbounded MutableQueue.

Signature

declare function unbounded<A>(): MutableQueue<A>

Getters

capacity

Added in v2.0.0 Source

The maximum number of elements that a queue can hold.

Note: unbounded queues can still implement this interface with capacity = Infinity.

Signature

declare function capacity<A>(self: MutableQueue<A>): number

isEmpty

Added in v2.0.0 Source

Returns true if the queue is empty, false otherwise.

Signature

declare function isEmpty<A>(self: MutableQueue<A>): boolean

isFull

Added in v2.0.0 Source

Returns true if the queue is full, false otherwise.

Signature

declare function isFull<A>(self: MutableQueue<A>): boolean

length

Added in v2.0.0 Source

Returns the current number of elements in the queue.

Signature

declare function length<A>(self: MutableQueue<A>): number

Model

MutableQueue interface

Added in v2.0.0 Source

Signature

interface MutableQueue<out A> extends Iterable<A>, Pipeable, Inspectable {
readonly [TypeId]: typeof TypeId;
}

Other

MutableQueue

Added in v2.0.0 Source

offer

Added in v2.0.0 Source

Offers an element to the queue.

Returns whether the enqueue was successful or not.

Signature

declare const offer: {
<A>(self: MutableQueue<A>, value: A): boolean;
<A>(value: A): (self: MutableQueue<A>) => boolean;
}

offerAll

Added in v2.0.0 Source

Enqueues a collection of values into the queue.

Returns a Chunk of the values that were not able to be enqueued.

Signature

declare const offerAll: {
<A>(values: Iterable<A>): (self: MutableQueue<A>) => Chunk<A>;
<A>(self: MutableQueue<A>, values: Iterable<A>): Chunk<A>;
}

poll

Added in v2.0.0 Source

Dequeues an element from the queue.

Returns either an element from the queue, or the def param.

Note: if there is no meaningful default for your type, you can always use poll(MutableQueue.EmptyMutableQueue).

Signature

declare const poll: {
<D>(def: D): <A>(self: MutableQueue<A>) => D | A;
<A, D>(self: MutableQueue<A>, def: D): A | D;
}

pollUpTo

Added in v2.0.0 Source

Dequeues up to n elements from the queue.

Returns a List of up to n elements.

Signature

declare const pollUpTo: {
(n: number): <A>(self: MutableQueue<A>) => Chunk<A>;
<A>(self: MutableQueue<A>, n: number): Chunk<A>;
}

Symbol

Signature

declare const EmptyMutableQueue: typeof EmptyMutableQueue

TypeId type

Added in v2.0.0 Source

Signature

type TypeId = typeof TypeId