Skip to main content

Collection

Trait Collection 

Source
pub trait Collection<T: ?Sized> {
    // Required methods
    fn len(&self) -> usize;
    fn get(&self, idx: usize) -> Option<&T>;
    fn get_mut(&mut self, idx: usize) -> Option<&mut T>;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}

Required Methods§

Source

fn len(&self) -> usize

Source

fn get(&self, idx: usize) -> Option<&T>

Source

fn get_mut(&mut self, idx: usize) -> Option<&mut T>

Provided Methods§

Source

fn is_empty(&self) -> bool

Trait Implementations§

Source§

impl<T> Collection<T> for &mut dyn Collection<T>

Source§

fn len(&self) -> usize

Source§

fn get(&self, idx: usize) -> Option<&T>

Source§

fn get_mut(&mut self, idx: usize) -> Option<&mut T>

Source§

fn is_empty(&self) -> bool

Implementations on Foreign Types§

Source§

impl<T> Collection<T> for &mut [T]

Source§

fn len(&self) -> usize

Source§

fn get(&self, idx: usize) -> Option<&T>

Source§

fn get_mut(&mut self, idx: usize) -> Option<&mut T>

Source§

impl<T> Collection<T> for [T]

Source§

fn len(&self) -> usize

Source§

fn get(&self, idx: usize) -> Option<&T>

Source§

fn get_mut(&mut self, idx: usize) -> Option<&mut T>

Implementors§

Source§

impl<'src, Src, T: ?Sized, U: ?Sized> Collection<U> for MappedCollection<'src, Src, T, U>
where Src: Collection<T> + ?Sized,

Source§

impl<T> Collection<T> for &mut dyn Collection<T>