Data.Vec
The growable array: push and pop change its length.
An array literal builds one directly when inference decides it is a Vec,
out of the two records below by name: Vec over a VecStorage with the
fields storage and length. Renaming any of them means changing how the
compiler lowers a literal in the same commit.
An empty Vec with room for capacity elements before it must grow.
Both copy: a Vec and an Array never share their elements.
Push count elements from raw memory at source, laid out as the storage
lays them out, for the rest of the library: a program cannot hold a
Ptr. Untraced elements only, which the compiler checks.
Drop every element, keeping the capacity. The elements themselves are still
reachable from the storage until they are overwritten, which costs nothing a
compiler notices and saves the reallocation a fresh Vec would need.
f of each element of xs, in order. xs is anything with a length that
can be iterated, so an Array maps straight to a Vec.
Returns the result of calling step on the accumulator and each element in
turn. Iter.fold takes the same arguments and works on anything iterable.
Copy count elements of source, from index from on, over those of
target from index at on, as Array.copy does. Only over elements
target has: this never changes its length, and panics unless both runs
are inside their Vecs.
Set the count elements of target from index at on to value.
Panics unless they are all elements of target.
A copy, not a view. A view would alias storage that push is free to
reallocate out from under it, and the growth policy is deliberately not part
of this type's contract.
A stable sort, answering a new Vec; Turkey.Array says how.
Sorted by key, stably, calling key once per element, as Array.sortByKey
is: two Vecs of pairs bought so that key is not called per comparison.
Ord answers in Bool, so a three-way comparison costs two questions.
Ordering is the shape a sort wants, and this is the adapter.
Equal when they have the same length and equal elements at each index.
Compares element by element from the front: the first index where the two differ decides, and a vector that is a proper prefix of the other is less.
Its elements, as the array literal that builds it. Only the first
length slots are read: the rest may never have been written.
What its Debug prints: a container's text shows its elements' Debug,
so that a string in it is quoted.