Skip to content

Commit

Permalink
Merge pull request rust-lang#280 from 0x7CFE/async-refactoring
Browse files Browse the repository at this point in the history
Tiny refactoring of poll::Async
  • Loading branch information
alexcrichton authored Dec 7, 2016
2 parents 1fdb5f4 + b35d428 commit dcf960a
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/poll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,22 @@ impl<T> Async<T> {
where F: FnOnce(T) -> U
{
match self {
Async::NotReady => Async::NotReady,
Async::Ready(t) => Async::Ready(f(t)),
Async::NotReady => Async::NotReady,
}
}

/// Returns whether this is `Async::NotReady`
pub fn is_not_ready(&self) -> bool {
/// Returns whether this is `Async::Ready`
pub fn is_ready(&self) -> bool {
match *self {
Async::NotReady => true,
Async::Ready(_) => false,
Async::Ready(_) => true,
Async::NotReady => false,
}
}

/// Returns whether this is `Async::Ready`
pub fn is_ready(&self) -> bool {
!self.is_not_ready()
/// Returns whether this is `Async::NotReady`
pub fn is_not_ready(&self) -> bool {
!self.is_ready()
}
}

Expand All @@ -75,17 +75,17 @@ pub enum AsyncSink<T> {
}

impl<T> AsyncSink<T> {
/// Returns whether this is `AsyncSink::NotReady`
pub fn is_not_ready(&self) -> bool {
/// Returns whether this is `AsyncSink::Ready`
pub fn is_ready(&self) -> bool {
match *self {
AsyncSink::NotReady(_) => true,
AsyncSink::Ready => false,
AsyncSink::Ready => true,
AsyncSink::NotReady(_) => false,
}
}

/// Returns whether this is `AsyncSink::Ready`
pub fn is_ready(&self) -> bool {
!self.is_not_ready()
/// Returns whether this is `AsyncSink::NotReady`
pub fn is_not_ready(&self) -> bool {
!self.is_ready()
}
}

Expand Down

0 comments on commit dcf960a

Please sign in to comment.