pub trait ElementAtOrDefault {
type Item;
// Required method
fn elementat_or_default(&self, index: usize) -> Self::Item;
}Expand description
Provides indexed lookup with a default value when the index is out of range.
Required Associated Types§
Required Methods§
Sourcefn elementat_or_default(&self, index: usize) -> Self::Item
fn elementat_or_default(&self, index: usize) -> Self::Item
Returns the item at index, or T::default() when no item exists there.