Trait gat_lending_iterator::ToLendingIterator

source ·
pub trait ToLendingIterator: IntoIterator {
    // Provided methods
    fn windows(self, size: usize) -> Windows<Self::IntoIter>
       where Self: Sized { ... }
    fn windows_mut(self, size: usize) -> WindowsMut<Self::IntoIter>
       where Self: Sized { ... }
    fn into_lending(self) -> IntoLending<Self::IntoIter>
       where Self: Sized { ... }
    fn lend_refs(self) -> LendRefs<Self::IntoIter>
       where Self: Sized { ... }
    fn lend_refs_mut(self) -> LendRefsMut<Self::IntoIter>
       where Self: Sized { ... }
}
Expand description

An extension trait for iterators that allows turning them into lending iterators (over windows of elements).

Provided Methods§

source

fn windows(self, size: usize) -> Windows<Self::IntoIter>
where Self: Sized,

Turns this iterator into a lending iterator over windows of elements (&[Item]).

Windows is backed by a buffer that grows to at most size * 2. This was chosen as a compromise between memory usage and time complexity: if the buffer was limited to size size, we would need to shift all the elements on every iteration.

source

fn windows_mut(self, size: usize) -> WindowsMut<Self::IntoIter>
where Self: Sized,

Turns this iterator into a lending iterator over mutable windows of elements (&mut [Item]).

WindowsMut is backed by a buffer that grows to at most size * 2. This was chosen as a compromise between memory usage and time complexity: if the buffer was limited to size size, we would need to shift all the elements on every iteration.

source

fn into_lending(self) -> IntoLending<Self::IntoIter>
where Self: Sized,

Turns this iterator into a lending iterator trivially.

source

fn lend_refs(self) -> LendRefs<Self::IntoIter>
where Self: Sized,

Turns this iterator into a lending iterator that lends references to the iterator’s items.

source

fn lend_refs_mut(self) -> LendRefsMut<Self::IntoIter>
where Self: Sized,

Turns this iterator into a lending iterator that lends mutable references to the iterator’s items.

Implementors§