Trait IterateIntoCache

Source
pub trait IterateIntoCache: Iterator
where Self::Item: Clone,
{ // Required methods fn cache( self, quantity: u32, ) -> Result<IteratorCache<Self::Item>, Box<dyn Error>>; fn cache_all(self) -> IteratorCache<Self::Item> ; fn cache_or_all(self, quantity: u32) -> IteratorCache<Self::Item> ; }
Expand description

Any Iterator can have its values cached with the methods in this trait. (Currently only iterators where Item: Clone are supported, due to trait bounds on the queue from the queues crate)

Required Methods§

Source

fn cache( self, quantity: u32, ) -> Result<IteratorCache<Self::Item>, Box<dyn Error>>

Cache a given amount of items from this iterator for use later.

§Errors

Errors if the iterator runs out of items while caching To avoid the error, consider using cache_or_all()

Source

fn cache_all(self) -> IteratorCache<Self::Item>

Cache all items from this iterator for use later

Source

fn cache_or_all(self, quantity: u32) -> IteratorCache<Self::Item>

Cache a given amount of items from this iterator for use later, or end early if the iterator runs out

Implementors§

Source§

impl<'a, T> IterateIntoCache for T
where T: Iterator + 'static, T::Item: Clone,