Trait fera_array::Array

source ·
pub trait Array<T>: IndexMut<usize, Output = T> {
    fn with_value(value: T, n: usize) -> Self
    where
        Self: Sized,
        T: Clone
; fn len(&self) -> usize; unsafe fn get_unchecked(&self, index: usize) -> &T; unsafe fn get_unchecked_mut(&mut self, index: usize) -> &mut T; fn contains(&self, value: &T) -> bool
    where
        T: PartialEq
, { ... } fn is_empty(&self) -> bool { ... } fn get(&self, index: usize) -> Option<&T> { ... } fn get_mut(&mut self, index: usize) -> Option<&mut T> { ... } fn iter(&self) -> Iter<'_, T, Self>
    where
        Self: Sized
, { ... } }
Expand description

A simple trait for array like structs.

Required Methods

Creates a new array with n repeated value.

Returns the number of elements in the array.

Returns a reference to the element of the array at index, without doing bounds checking.

Returns a mutable reference to the element of the array at index, without doing bounds checking.

Provided Methods

Returns true if the array contains value, false otherwise.

Returns true if the length of the array is 0, otherwise false.

Returns a reference to the element of the array at index, or None if the index is out of bounds.

Returns a mutable reference to the element of the array at index, or None if the index is out of bounds.

Returns a iterator over the array.

Implementors