Belt.MutableQueueAn FIFO(first in first out) queue data structure
First-in first-out queues.
This module implements queues (FIFOs), with in-place modification.
let make: unit => t('a);let clear: t('a) => unit;Discard all elements from the queue.
let isEmpty: t('a) => bool;let fromArray: array('a) => t('a);fromArray a is equivalent to Array.forEach a (add q a)
let add: t('a) => 'a => unit;add q x adds the element x at the end of the queue q.
let peek: t('a) => option('a);peekOpt q returns the first element in queue q, without removing it from the queue.
let peekUndefined: t('a) => Js.undefined('a);peekUndefined q returns undefined if not found
let peekExn: t('a) => 'a;peekExn q
raise an exception if q is empty
let pop: t('a) => option('a);pop q removes and returns the first element in queue q.
let popUndefined: t('a) => Js.undefined('a);popUndefined q removes and returns the first element in queue q. it will return undefined if it is already empty
let popExn: t('a) => 'a;popExn q
raise an exception if q is empty
let size: t('a) => int;let forEachU: t('a) => Js.Fn.arity1(('a => unit)) => unit;let forEach: t('a) => ('a => unit) => unit;forEach q f applies f in turn to all elements of q, from the least recently entered to the most recently entered. The queue itself is unchanged.
let reduceU: t('a) => 'b => Js.Fn.arity2(('b => 'a => 'b)) => 'b;let reduce: t('a) => 'b => ('b => 'a => 'b) => 'b;reduce q accu f is equivalent to List.reduce l accu f, where l is the list of q's elements. The queue remains unchanged.
transfer q1 q2 adds all of q1's elements at the end of the queue q2, then clears q1. It is equivalent to the sequence forEach (fun x -> add x q2) q1; clear q1, but runs in constant time.
let toArray: t('a) => array('a);First added will be in the beginning of the array