Skip to content

Commit 54aaf3d

Browse files
authored
time: document immediate completion guarantee for timeouts (#5509)
1 parent 5a3abe5 commit 54aaf3d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tokio/src/time/timeout.rs

+10
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ use std::task::{self, Poll};
2828
/// This function returns a future whose return type is [`Result`]`<T,`[`Elapsed`]`>`, where `T` is the
2929
/// return type of the provided future.
3030
///
31+
/// If the provided future completes immediatelly, then the future returned from
32+
/// this function is guaranteed to complete immediatelly with an [`Ok`] variant
33+
/// no matter the provided duration.
34+
///
35+
/// [`Ok`]: std::result::Result::Ok
3136
/// [`Result`]: std::result::Result
3237
/// [`Elapsed`]: crate::time::error::Elapsed
3338
///
@@ -100,6 +105,11 @@ where
100105
/// This function returns a future whose return type is [`Result`]`<T,`[`Elapsed`]`>`, where `T` is the
101106
/// return type of the provided future.
102107
///
108+
/// If the provided future completes immediatelly, then the future returned from
109+
/// this function is guaranteed to complete immediatelly with an [`Ok`] variant
110+
/// no matter the provided deadline.
111+
///
112+
/// [`Ok`]: std::result::Result::Ok
103113
/// [`Result`]: std::result::Result
104114
/// [`Elapsed`]: crate::time::error::Elapsed
105115
///

0 commit comments

Comments
 (0)