Function eventuals::map_with_retry [−][src]
pub fn map_with_retry<I, Ok, Err, F, Fut, E, FutE>(
source: Eventual<I>,
f: F,
on_err: E
) -> Eventual<Ok> where
F: 'static + Send + FnMut(I) -> Fut,
E: 'static + Send + Sync + FnMut(Err) -> FutE,
I: Value,
Ok: Value,
Err: Value,
Fut: Send + Future<Output = Result<Ok, Err>>,
FutE: Send + Future<Output = ()>,
Expand description
Ensure that a fallible map operation will succeed eventually. For example given map_with_retry([“url_1”, “url_2”], fallibly_get_data, sleep) may produce [“data_1”, “data_2”] or just [“data_2”]. The difference between map_with_retry and something like map(source, retry(fallibly_get_data, on_err)) is that the former supports ‘moving on’ to “url_2” even if “url_1” is in a retry state, whereas the latter would have to complete one item fully before progressing. It is because of this distinction that map_with_retry is allowed to retry forever instead of giving up after a set number of attempts.