pub trait IterateIntoCache: Iterator{
// 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§
Sourcefn cache(
self,
quantity: u32,
) -> Result<IteratorCache<Self::Item>, Box<dyn Error>>
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()
Sourcefn cache_all(self) -> IteratorCache<Self::Item> ⓘ
fn cache_all(self) -> IteratorCache<Self::Item> ⓘ
Cache all items from this iterator for use later
Sourcefn cache_or_all(self, quantity: u32) -> IteratorCache<Self::Item> ⓘ
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