pub trait Len: Empty {
// Required method
fn len(&self) -> usize;
}Expand description
A trait for describing the length of a collection.
The amount of data stored in a collection, i.e. the amount of space it requires in memory, is
directly proportional to its length. For this reason, str and other types measure their
lengths in code values (e.g. u8), not code points (e.g. char).
Obtaining the length of the collection must take a constant amount of time and space.