pub fn retry_sleep_under_total_deadline(
total_deadline: Option<Duration>,
elapsed: Duration,
delay: Duration,
) -> Option<Duration>Expand description
Returns the sleep duration to use for a retry under an optional
cross-attempt total deadline (REL-01), or None when the deadline has
been exhausted and the retry must be aborted. When the deadline is set
and the full delay would cross it, the sleep is clamped to the
remaining slice so the loop never sleeps past the deadline. Pure in
elapsed so tests can pin the clock; the production wrapper is
retry_sleep_within_total.
total_deadline == None: the fulldelay(unbounded, the v1 default).elapsed >= total_deadline:None(abort the retry).- otherwise:
min(delay, total_deadline - elapsed).