[][src]Function safina::with_deadline

pub async fn with_deadline<R, Fut>(
    inner: Fut,
    deadline: Instant
) -> Result<R, DeadlineExceeded> where
    Fut: 'static + Send + Future<Output = R>, 

Awaits inner, but returns DeadlineExceeded after deadline.

First moves inner to the heap, to make it Unpin. Use DeadlineFuture::new to avoid allocating on the heap.

Panics if start_timer_thread() has not been called. If you need to handle this error, use DeadlineFuture::new.