# [−] [src] Function tokio::time::timeout_at

###

    pub fn timeout_at<T>(deadline: Instant, future: T) -> Timeout<T>ⓘNotable traits for Timeout<T>impl<T> Future for Timeout<T> where
        T: Future,     type Output = Result<T::Output, Elapsed>; where
        T: Future,

Require a `Future` to complete before the specified instant in time.

If the future completes before the instant is reached, then the completed value is returned. Otherwise, an error is returned.

# Cancelation

Cancelling a timeout is done by dropping the future. No additional cleanup or other work is required.

The original future may be obtained by calling `Timeout::into_inner`. This consumes the `Timeout`.

# Examples

Create a new `Timeout` set to expire in 10 milliseconds.

    use tokio::time::{Instant, timeout_at};
    use tokio::sync::oneshot;

    use std::time::Duration;

    let (tx, rx) = oneshot::channel();

    // Wrap the future with a `Timeout` set to expire 10 milliseconds into the
    // future.
    if let Err(_) = timeout_at(Instant::now() + Duration::from_millis(10), rx).await {
        println!("did not receive value within 10 ms");
    }