pub async fn retry_async_cancelable<T, Op, Fut, IsRetryable, E>(
policy: &NetworkRetryPolicy,
label: Option<&'static str>,
op: Op,
is_retryable: IsRetryable,
cancel: &CancellationToken,
) -> Result<T, E>Expand description
Like retry_async but honours a CancellationToken during inter-retry sleep.
Same semantics as retry_async except that if cancel fires while waiting
between attempts, the function returns the last operation error immediately.
Cancellation is not checked during the operation itself — the caller is
responsible for making the operation itself cancellation-aware if needed.
label, if Some, is emitted as a structured component tracing field
(see retry_async for details).
§Example
ⓘ
let cancel = CancellationToken::new();
let result = retry_async_cancelable(
&config.reconnect,
Some("container-events"),
|| async move { make_network_call().await },
|err| is_transient(err),
&cancel,
).await;