MutPriorityQueue
Type of mutable priority queues, and its functions.
struct MutPriorityQueue[a: Type, r: Eff]SourceType of mutable priority queues.
Explanation of component types (left to right): Component 1: The region capability the queue is associated with. Component 2: A reference to the backing array. Component 3: A reference to the number of elements in the mutable priority queue.
The maximum element (if it exists) can always be accessed in constant time.
Instances
Definitions
def dequeue(mq: MutPriorityQueue[a, r]): Option[a] \ r with Order[a]§ SourceRemoves and optionally returns the top element of mq.
def empty(rc: Region[r]): MutPriorityQueue[a, r] \ r§ SourceReturns an empty MutPriorityQueue with a default capacity.
def emptyWithCapacity(rc: Region[r], capacity: Int32): MutPriorityQueue[a, r] \ r§ SourceReturns an empty MutPriorityQueue with the given capacity rounded up to the default capacity.
def enqueue(x: a, mq: MutPriorityQueue[a, r]): Unit \ r with Order[a]§ SourceEnqueues an element x into a mq.
def enqueueAll(m: m, mq: MutPriorityQueue[elt, r]): Unit \ r + ForEach.Aef[m] with ForEach[m], Order[elt] where ForEach.Elm[m] ~ elt§ SourceEnqueues each element in m into mq.
def forEach(f: a -> Unit \ ef, q: MutPriorityQueue[a, r]): Unit \ ef + r§ SourceApplies f to every element of q.
def isEmpty(mq: MutPriorityQueue[a, r]): Bool \ r§ SourceReturns whether mq is empty.
def iterator(rc: Region[r1], mq: MutPriorityQueue[a, r2]): Iterator[a, r1 + r2, r1] \ r1 + r2§ SourceReturns an iterator over mq.
Modifying mq during iteration is undefined and not recommended.
def nonEmpty(mq: MutPriorityQueue[a, r]): Bool \ r§ SourceReturns whether mq is non-empty.
def peek(mq: MutPriorityQueue[a, r]): Option[a] \ r§ SourceOptionally returns the top element of mq.
def size(mq: MutPriorityQueue[a, r]): Int32 \ r§ SourceReturns the number of elements in mq.
def toArray(rc: Region[r1], mq: MutPriorityQueue[a, r2]): Array[a, r1] \ r1 + r2§ SourceReturns an Array representation of mq.
Note that a MutPriorityQueue's element order depends on the order in which the elements were enqueued.
def toList(mq: MutPriorityQueue[a, r]): List[a] \ r with Order[a]§ SourceReturns a List representation of mq.
Note that a MutPriorityQueue's element order depends on the order in which the elements were enqueued.
Optionally returns a Nel representation of mq.
def toString(mq: MutPriorityQueue[a, r]): String \ r with ToString[a]§ SourceReturns a String representation of the mutable priority queue mq.
def toVector(mq: MutPriorityQueue[a, r]): Vector[a] \ r§ SourceReturns an Vector representation of mq.
Note that a MutPriorityQueue's element order depends on the order in which the elements were enqueued.