Skip to main content

Length

Trait Length 

Source
pub trait Length {
    // Required method
    fn length(&self) -> usize;
}
Expand description

Values that have a length (see Len and NonEmpty).

The length of strings is the number of characters, of collections the number of items.

Required Methods§

Source

fn length(&self) -> usize

Returns the length.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Length for String

Source§

fn length(&self) -> usize

Source§

impl Length for str

Source§

fn length(&self) -> usize

Source§

impl<K, V, S> Length for HashMap<K, V, S>

Source§

fn length(&self) -> usize

Source§

impl<K, V> Length for BTreeMap<K, V>

Source§

fn length(&self) -> usize

Source§

impl<T, S> Length for HashSet<T, S>

Source§

fn length(&self) -> usize

Source§

impl<T, const N: usize> Length for [T; N]

Source§

fn length(&self) -> usize

Source§

impl<T: Length + ?Sized> Length for &T

Source§

fn length(&self) -> usize

Source§

impl<T: Length + ?Sized> Length for Box<T>

Source§

fn length(&self) -> usize

Source§

impl<T: Length + ToOwned + ?Sized> Length for Cow<'_, T>

Source§

fn length(&self) -> usize

Source§

impl<T> Length for BTreeSet<T>

Source§

fn length(&self) -> usize

Source§

impl<T> Length for Vec<T>

Source§

fn length(&self) -> usize

Source§

impl<T> Length for VecDeque<T>

Source§

fn length(&self) -> usize

Source§

impl<T> Length for [T]

Source§

fn length(&self) -> usize

Implementors§