embassy-time

Crates

git

Versions

default

Flavors

embassy_time

Function with_deadline

source
pub async fn with_deadline<F: Future>(
    at: Instant,
    fut: F,
) -> Result<F::Output, TimeoutError>
Expand description

Runs a given future with a deadline time.

If the future completes before the deadline, its output is returned. Otherwise, on timeout, work on the future is stopped (poll is no longer called), the future is dropped and Err(TimeoutError) is returned.