Collection

Trait Collection 

Source
pub trait Collection {
    type Item;

    // Required method
    fn size(&self) -> usize;

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

trait to impl for any type that represents a collection of items

Required Associated Types§

Source

type Item

Item Type of collection

Required Methods§

Source

fn size(&self) -> usize

Number of items in the collection

Provided Methods§

Source

fn is_empty(&self) -> bool

Helper function for whether collection has elements

Implementations on Foreign Types§

Source§

impl<T> Collection for Vec<T>

Source§

type Item = T

Source§

fn size(&self) -> usize

Implementors§