pub trait ArrayLike<T>: Index<usize, Output = T> {
const LEN: usize;
// Required methods
fn create(create_element: impl FnMut() -> T) -> Self;
fn iter(&self) -> Iter<'_, T>;
}
Expand description
Abstracts over fixed-length arrays (and similar types) with an element type T
.
Provides iter
and Index
rather than Deref
or AsRef<[T]>
to allow for alternate forms of
indexing, for which exposing a slice could be confusing. See OneBased
.
Required Associated Constants§
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.