crb_core::time

Function timeout

Source
pub async fn timeout<T>(
    duration: Option<Duration>,
    fut: T,
) -> Result<T::Output, Elapsed>
where T: Future,
Expand description

Requires a Future to complete before the specified duration has elapsed.

If duration is not set it waits for the fut completion only.