diff --git a/src/libstd/sync/condvar.rs b/src/libstd/sync/condvar.rs index 11ba4a8023dc..f33cdc36683a 100644 --- a/src/libstd/sync/condvar.rs +++ b/src/libstd/sync/condvar.rs @@ -20,7 +20,7 @@ use time::Duration; /// A type indicating whether a timed wait on a condition variable returned /// due to a time out or not. -#[derive(Debug, PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq, Copy, Clone)] #[unstable(feature = "wait_timeout", reason = "newly added")] pub enum TimedOut { /// The wait timed out. @@ -29,6 +29,13 @@ pub enum TimedOut { No } +impl TimedOut { + /// Returns `true` iff the value of `self` is `Yes`. + pub fn timed_out(&self) -> bool { + *self == TimedOut::Yes + } +} + /// A Condition Variable /// /// Condition variables represent the ability to block a thread such that it