Module array

1.35.0 Β· Source
Expand description

Utilities for the array primitive type.

See also the array primitive type.

Re-exportsΒ§

pub use iter::IntoIter;

ModulesΒ§

ascii πŸ”’
drain πŸ”’
equality πŸ”’
iter πŸ”’
Defines the IntoIter owned iterator for arrays.

MacrosΒ§

array_impl_default πŸ”’

StructsΒ§

Guard πŸ”’
Panic guard for incremental initialization of arrays.
TryFromSliceError
The error type returned when a conversion from a slice to an array fails.

TraitsΒ§

SpecArrayClone πŸ”’

FunctionsΒ§

from_fn
Creates an array where each element is produced by calling f with that element’s index while walking forward through the array.
from_mut
Converts a mutable reference to T into a mutable reference to an array of length 1 (without copying).
from_ref
Converts a reference to T into a reference to an array of length 1 (without copying).
from_trusted_iterator πŸ”’
Populate an array from the first N elements of iter
iter_next_chunk πŸ”’
Pulls N items from iter and returns them as an array. If the iterator yields fewer than N items, Err is returned containing an iterator over the already yielded items.
iter_next_chunk_erased πŸ”’
Version of iter_next_chunk using a passed-in slice in order to avoid needing to monomorphize for every array length.
try_from_fn_erased πŸ”’
Version of try_from_fn using a passed-in slice in order to avoid needing to monomorphize for every array length.
try_from_trusted_iterator πŸ”’
repeatExperimental
Creates an array of type [T; N] by repeatedly cloning a value.
try_from_fnExperimental
Creates an array [T; N] where each fallible array element T is returned by the cb call. Unlike from_fn, where the element creation can’t fail, this version will return an error if any element creation was unsuccessful.