Trait len_trait::len::Len
[−]
[src]
pub trait Len: Empty { fn len(&self) -> usize; }
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.
Required Methods
Implementors
impl<T> Len for [T]
impl Len for str
impl Len for CStr
impl Len for CString
impl Len for OsStr
impl Len for OsString
impl<K: Eq + Hash, V> Len for HashMap<K, V>
impl<T: Eq + Hash> Len for HashSet<T>
impl<K: Ord, V> Len for BTreeMap<K, V>
impl<T: Ord> Len for BTreeSet<T>
impl<T: Ord> Len for BinaryHeap<T>
impl<T> Len for LinkedList<T>
impl Len for String
impl<T> Len for Vec<T>
impl<T> Len for VecDeque<T>