pub trait ArrayTrait {
type Element;
// Required methods
fn get<I>(
&self,
i: I,
) -> Option<&<I as SliceIndex<[Self::Element]>>::Output>
where I: SliceIndex<[Self::Element]>;
fn iter<'i>(&'i self) -> Box<dyn Iterator<Item = &'i Self::Element> + 'i>;
fn len(&self) -> usize;
// Provided method
fn is_empty(&self) -> bool { ... }
}
Expand description
A trait for the minimal common functionality of a vale array
Required Associated Types§
Required Methods§
sourcefn get<I>(&self, i: I) -> Option<&<I as SliceIndex<[Self::Element]>>::Output>where
I: SliceIndex<[Self::Element]>,
fn get<I>(&self, i: I) -> Option<&<I as SliceIndex<[Self::Element]>>::Output>where
I: SliceIndex<[Self::Element]>,
Gets a ref to a value based on n index, returns None
if the
current Value isn’t an Array or doesn’t contain the index
it was asked for.
Provided 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.