# Function cargo::util::network::retry::with_retry

source ·

    pub fn with_retry<T, F>(config: &Config, 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(&config, || download_something());