Skip to main content

AsIter

Trait AsIter 

Source
pub trait AsIter {
    type Item;
    type Iterator<'a>: Iterator<Item = &'a Self::Item>
       where Self: 'a;

    // Required method
    fn iter(&self) -> Self::Iterator<'_>;

    // Provided methods
    fn is_empty(&self) -> bool { ... }
    fn len(&self) -> usize { ... }
}

Required Associated Types§

Source

type Item

Source

type Iterator<'a>: Iterator<Item = &'a Self::Item> where Self: 'a

Required Methods§

Source

fn iter(&self) -> Self::Iterator<'_>

Provided Methods§

Source

fn is_empty(&self) -> bool

Source

fn len(&self) -> usize

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T> AsIter for Vec<T>

Source§

type Item = T

Source§

type Iterator<'a> = Iter<'a, <Vec<T> as AsIter>::Item> where T: 'a

Source§

fn iter(&self) -> Self::Iterator<'_>

Implementors§