#iterator #cache #data-structure


Iterator adaptor with caching that allows reiterating over the same iterator through the cache

4 releases

✓ Uses Rust 2018 edition

0.1.3 May 20, 2019
0.1.2 Mar 29, 2019
0.1.1 Mar 29, 2019
0.1.0 Feb 2, 2019

#21 in Caching

42 downloads per month
Used in 2 crates (1 directly)


155 lines


Build Status Current Version License: MIT/Apache-2.0

An adaptor around an iterator that can produce multiple iterators sharing an underlying cache.

The underlying iterator must produce heap-allocated StableDeref values, e.g. Box or String. If you have an iterator that produces Copy values, use CopyReiterator instead.

use reiterate::Reiterate;
let x = vec!["a".to_string(), "b".to_string(), "c".to_string(), "d".to_string()];
let reiterate = Reiterate::new(x);
for i in &reiterate {
    println!("{}", i);    
for i in &reiterate {
    // will reuse cached values
    println!("{}", i);