The type of a flat queue. 'slots will look like ('a1, ..., 'an) Slots.tn, and the
queue holds flat tuples of type 'a1 * ... * 'an.
capacity t returns the length of the array backing t. Enqueueing values will not
cause the array to grow as long as length t <= capacity t. A queue at capacity
will automatically increase capacity when enqueueing. The capacity never decreases
automatically; one can only decrease capacity via set_capacity.
set_capacity t capacity sets the length of the array backing t to as small as
value as possible that is not less than max capacity (length t). To shrink as much
as possible, do set_capacity t 0.
drop_front ?n t drops the the first n elements of t. It raises if n < 0 || n >
length t.
Flat_queue does not have dequeue or dequeue_exn because the expected usage is to
use get t 0 Slot.tj to access the front of the queue, and then to use drop_front
to remove it. This usage avoids ever allocating an ordinary OCaml tuple.
clear t removes all elements from t.
The functions below deal with Flat-array tuples as ordinary OCaml tuples. These are intended for convenience but not for performance-critical code, due to the tuple allocation.
get_all_slots t i allocates a new ordinary OCaml tuple whose components are equal to
the slots of the flat tuple at index i of t. This is esentially an allocation
plus a blit from t to the newly allocated tuple.
set_all_slots t i tuple sets all slots of the flat tuple at index i of t to
their corresponding components of tuple. This is essentially a blit from tuple to
t.
It is required that 0 <= i < length t.