pub async fn timeout<F: Future>(
duration: Duration,
fut: F,
) -> Result<F::Output, Elapsed>Expand description
Await fut, giving up after duration — the seam’s only bounded wait.
It belongs here rather than at the call sites for the same reason sleep
does: a deadline needs a timer, and which timer that is depends on the
backend. Call sites that reach for tokio::time::timeout directly pin
themselves to the tokio timer wheel.