ariel_os::reexports::embassy_time

Function with_deadline

pub async fn with_deadline<F>(
    at: Instant,
    fut: F,
) -> Result<<F as Future>::Output, TimeoutError>
where F: Future,
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.