cargo::util::network::retry

Function with_retry

source
pub fn with_retry<T, F>(gctx: &GlobalContext, callback: F) -> CargoResult<T>
where F: FnMut() -> CargoResult<T>,
Expand description

Wrapper method for network call retry logic.

Retry counts provided by Config object net.retry. Config shell outputs a warning on per retry.

Closure must return a CargoResult.

ยงExamples

use cargo::util::network;
let cargo_result = network::retry::with_retry(&gctx, || download_something());