diff options
| author | Steven Fackler <sfackler@gmail.com> | 2015-08-14 20:35:33 -0700 |
|---|---|---|
| committer | Steven Fackler <sfackler@gmail.com> | 2015-08-19 17:00:15 -0700 |
| commit | 46156de5f1d8a4ebfb874d170ba6844462b5781b (patch) | |
| tree | 61707f3901bedf7fad0b5a65c985c9c227751095 /src/libstd | |
| parent | 42a386fcf89a40e6c3a8806ccf381514c2a77c10 (diff) | |
| download | rust-46156de5f1d8a4ebfb874d170ba6844462b5781b.tar.gz rust-46156de5f1d8a4ebfb874d170ba6844462b5781b.zip | |
Add `TimedOut::timed_out`
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/sync/condvar.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libstd/sync/condvar.rs b/src/libstd/sync/condvar.rs index 11ba4a8023d..f33cdc36683 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 |
