Skip to main content

HasLength

Trait HasLength 

Source
pub trait HasLength {
    // Required method
    fn len(&self) -> usize;

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

Trait for data structures which have a length.

Required Methods§

Source

fn len(&self) -> usize

Return the length of the data structure.

Provided Methods§

Source

fn is_empty(&self) -> bool

Return whether the data structure is empty.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<A> HasLength for VecDeque<A>

Source§

fn len(&self) -> usize

Implementors§

Source§

impl<'a, A: 'a, const N: usize> HasLength for Slice<'a, A, N>

Source§

impl<'a, A: 'a, const N: usize> HasLength for SliceMut<'a, A, N>

Source§

impl<A, const N: usize> HasLength for RingBuffer<A, N>