crow/col/queue.crow
(source)
queue
[t
] record
(has non-public fields)
Immutable queue.
Supports efficient removal from the left and insertion to the right.
new
[t
] t
queue
()
Empty queue.
to
[t
] t
queue
(a
t
array
)
to
[t
] t
array
(a
t
queue
)
Copies queue elements to an array.
This is O(n).
is-empty
[t
] bool
(a
t
queue
)
true
iff a.size == 0
.
size
[t
] nat64
(a
t
queue
)
Number of elements in the queue.
~
[t
] t
queue
(a
t
queue
, value
t
)
Adds a new element on the right.
dequeue
[t
] (t
, t
queue
) tuple2
?
(a
t
queue
)
Removes and returns an element from the left.
Returns an empty option iff a
is empty.
iterate
[t
] bool
(a
t
queue
, f
mut
bool
(t
))
queue-builder
[t
] record
mut
(has non-public fields)