FrozenArray
No module comment.
An array that nobody can write: its length and its elements are fixed when
it is made. Equal frozen arrays hash alike, so one can be a Map key or a
Set element, which a mutable Array cannot. The freezing is shallow: which
elements it holds is fixed, but an element that is itself mutable can still
change, and a key holding one can be lost as a mutable key is.
Its one field is not exported, and no function here writes to storage it
has wrapped, so module privacy is the whole guarantee. That holds only
while every function that makes one wraps storage nothing else holds:
freeze copies, because its caller keeps the source.
An array literal the program uses as a FrozenArray is built as this
constructor applied to the literal's fresh storage, by name; renaming it
means changing how the compiler lowers a literal in the same commit.
A frozen array is a value, as a string is: nothing can tell two with the same
elements apart, so a literal could later be a shared constant. !Object
keeps identical off it.
Returns a frozen copy of the elements of xs, in iteration order. Copies,
so later writes to xs do not show. xs is anything with a length that
can be iterated, such as an Array, a Vec or a Deque.
Returns a new, writable Array of the same elements.
Returns a new Vec of the same elements.
Returns a frozen array of length elements, each value.
Returns a frozen array whose element i is f(i), computed in order from 0.
Returns a copy of xs with element i replaced by x. Copies once, so it
is the way to make a neighbouring state: building an Array and freezing
it copies twice. Panics unless 0 <= i < len(xs).
Returns Some of element i, or None when i is not an index of xs.
Returns Some of the last element, or None when xs is empty.
Returns the elements from index from up to but not including to.
Panics unless 0 <= from <= to <= len(xs).
Returns the elements of xs followed by those of ys.
Returns f of each element, in order.
Returns the elements for which keep is true, in order. keep is called
once per element, in order.
Returns step applied to initial and each element in turn.
Returns the elements in reverse order.
Returns the index of the first element equal to wanted, or None.
Returns whether some element equals wanted.
Returns the elements sorted by compare. The sort is stable.
Returns the elements in ascending order. The sort is stable.
Returns the elements sorted by key. The sort is stable, and key is
called exactly once per element.
Equal when they have the same length and equal elements at each index.
Lexicographic: the first unequal element decides, and a proper prefix is less than the longer array.
The length, then each element in order. The length goes first so that
nested arrays split into parts differently hash differently: [[1], [2, 3]]
and [[1, 2], [3]] feed different words.
Its elements, as the array literal that builds it.