Enumerable

Trait Enumerable 

Source
pub trait Enumerable {
    type Element;

    // Required methods
    fn len(&self) -> usize;
    fn element_ref(&self, index: usize) -> &Self::Element;
    fn element_copy(&self, index: usize) -> Self::Element;

    // Provided method
    fn element(&self, index: usize) -> &Self::Element { ... }
}
Expand description

Has length and indexed access.

Required Associated Types§

Source

type Element

Type of an element.

Required Methods§

Source

fn len(&self) -> usize

Length.

Source

fn element_ref(&self, index: usize) -> &Self::Element

Get element by reference.

Source

fn element_copy(&self, index: usize) -> Self::Element

Get element copying it.

Provided Methods§

Source

fn element(&self, index: usize) -> &Self::Element

Get element by reference.

Implementors§