Skip to main content

timeout_at

Function timeout_at 

Source
pub async fn timeout_at<F: Future>(
    deadline: Instant,
    fut: F,
) -> Result<F::Output, Elapsed>
Expand description

timeout against an absolute Instant instead of a duration — the seam’s tokio::time::timeout_at.

It exists because one deadline shared across several sequential awaits is a different bound from a fresh duration per await: caget_many gives its whole batch one deadline, so a slow first PV eats the budget the rest would otherwise each get in full. Expressing that with timeout would need the caller to do the subtraction, which is the arithmetic that drifts.