pub trait HasLength { // Required method fn len(&self) -> usize; // Provided method fn is_empty(&self) -> bool { ... } }
Trait for data structures which have a length.
Return the length of the data structure.
Return whether the data structure is empty.