Skip to content

Commit

Permalink
Reviewer comments
Browse files Browse the repository at this point in the history
  • Loading branch information
evanrittenhouse committed Jan 12, 2024
1 parent e7620df commit f219fbc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tokio-util/src/time/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ pub use delay_queue::DelayQueue;
use futures_core::Future;
use tokio::time::Timeout;

/// A trait which contains a variety of conevenient adapters and utilities for `Future`s.
pub trait FutureExt: Future + Sized {
/// A trait which contains a variety of convenient adapters and utilities for `Future`s.
pub trait FutureExt: Future {
/// A wrapper around [`tokio::time::timeout`], with the advantage that it is easier to write
/// fluent call chains.
///
Expand All @@ -37,7 +37,10 @@ pub trait FutureExt: Future + Sized {
/// assert!(res.is_err());
/// # }
/// ```
fn timeout(self, timeout: Duration) -> Timeout<Self> {
fn timeout(self, timeout: Duration) -> Timeout<Self>
where
Self: Sized,
{
tokio::time::timeout(timeout, self)
}
}
Expand Down

0 comments on commit f219fbc

Please sign in to comment.