map_retry

Crates.iomap_retry
lib.rsmap_retry
version0.1.2
sourcesrc
created_at2019-05-11 19:31:59.985425
updated_at2019-05-12 08:24:45.739952
descriptionZero dependency trait that provides retry function that works with iterators
homepage
repository
max_upload_size
id133593
size6,311
Peter Hrvola (hrvolapeter)

documentation

README

Map retry

A zero dependency trait that provides map_retry function on top of native iterators.

Map retry crate provides a trait that allows to repeat mapping on failed results. This is useful for doing IO such as loading webpages using iterators.

use map_retry::MapRetry;
fn retry() {
    let a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
    let res: Vec<_> = a.iter().map_retry(|a| do_failable_io(a)).collect();
    assert_eq!(a.len(), res.len());
}
Commit count: 0

cargo fmt