Function zng_task::with_deadline

source ยท
pub async fn with_deadline<O, F: Future<Output = O>>(
    fut: impl IntoFuture<IntoFuture = F>,
    deadline: impl Into<Deadline>,
) -> Result<F::Output, DeadlineError>
Expand description

Add a deadline to a future.

Returns the fut output or DeadlineError if the deadline elapses first.