#cache #iterator

reiterate

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

4 releases

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

#796 in Caching

Download history 850/week @ 2026-07-27 909/week @ 2026-08-03 952/week @ 2026-08-10 920/week @ 2026-08-17 787/week @ 2026-08-24 877/week @ 2026-08-31 1360/week @ 2026-09-07 1322/week @ 2026-09-14 2105/week @ 2026-09-21 1880/week @ 2026-09-28 1020/week @ 2026-10-05 1316/week @ 2026-10-12 1457/week @ 2026-10-19 1708/week @ 2026-10-26 645/week @ 2026-11-02 661/week @ 2026-11-09

4,845 downloads per month

MIT/Apache

8KB
155 lines

reiterate

Build Status 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);    
}

Dependencies

~97KB