pub fn timeout<F>(now: Time, duration: Duration, future: F) -> TimeoutFuture<F> ⓘExpand description
Creates a TimeoutFuture that wraps the given future with a timeout.
§Arguments
now- The current timeduration- How long until the timeout expiresfuture- The future to wrap
§Example
use asupersync::time::timeout;
use asupersync::types::Time;
use std::time::Duration;
use std::future::ready;
let future = timeout(Time::ZERO, Duration::from_secs(5), ready(42));
assert_eq!(future.deadline(), Time::from_secs(5));