Skip to content

Commit 46156de

Browse files
committed
Add TimedOut::timed_out
1 parent 42a386f commit 46156de

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/libstd/sync/condvar.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use time::Duration;
2020

2121
/// A type indicating whether a timed wait on a condition variable returned
2222
/// due to a time out or not.
23-
#[derive(Debug, PartialEq, Eq)]
23+
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
2424
#[unstable(feature = "wait_timeout", reason = "newly added")]
2525
pub enum TimedOut {
2626
/// The wait timed out.
@@ -29,6 +29,13 @@ pub enum TimedOut {
2929
No
3030
}
3131

32+
impl TimedOut {
33+
/// Returns `true` iff the value of `self` is `Yes`.
34+
pub fn timed_out(&self) -> bool {
35+
*self == TimedOut::Yes
36+
}
37+
}
38+
3239
/// A Condition Variable
3340
///
3441
/// Condition variables represent the ability to block a thread such that it

0 commit comments

Comments
 (0)