Skip to main content

Collection

Trait Collection 

Source
pub trait Collection {
    type Item;

    // Required methods
    fn iter<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Self::Item> + 'a>;
    fn len(&self) -> usize;

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

§============================================================================ QUERY VALUE BOUNDARIES

Explicit iteration contract for list/set wrapper types. Avoids implicit deref-based access to inner collections.

Required Associated Types§

Required Methods§

Source

fn iter<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Self::Item> + 'a>

Returns an iterator over the collection’s items.

Source

fn len(&self) -> usize

Returns the number of items in the collection.

Provided Methods§

Source

fn is_empty(&self) -> bool

Returns true if the collection contains no items.

Implementors§