pub trait Len {
    fn len(&self) -> usize;

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

Basic trait for anything that could have a length. Even if a lot of struct have a len() method in the standard library, to my knowledge this function is not included into any standard trait.

Required Methods

Returns the number of elements in the collection, also referred to as its length.

Provided Methods

Return true if the collection has no element.

Implementations on Foreign Types

Implementors