remove PollExt, add methods to std
@@ -41,68 +41,3 @@ macro_rules! ready {
$crate::Poll::Pending => return $crate::Poll::Pending,
})
}
-
-pub trait PollExt<T> {
- /// Change the ready value of this `Poll` with the closure provided
- fn map<U, F>(self, f: F) -> Poll<U>
- where F: FnOnce(T) -> U;
- /// Returns whether this is `Poll::Ready`
- fn is_ready(&self) -> bool;
- /// Returns whether this is `Poll::Pending`
- fn is_pending(&self) -> bool {
- !self.is_ready()
- }
-}
-
-impl<T> PollExt<T> for Poll<T> {
-
- fn map<U, F>(self, f: F) -> Poll<U>
- where F: FnOnce(T) -> U
- {
- match self {
- Poll::Ready(t) => Poll::Ready(f(t)),
- Poll::Pending => Poll::Pending,
- }
- }
-
- fn is_ready(&self) -> bool {
- match *self {
- Poll::Ready(_) => true,
- Poll::Pending => false,
- }
- }
-}
-
-pub trait PollResultExt<T, E> {
- /// Change the success value of this `Poll` with the closure provided
- fn map_ok<U, F>(self, f: F) -> Poll<Result<U, E>>
- where F: FnOnce(T) -> U;
- /// Change the error value of this `Poll` with the closure provided
- fn map_err<U, F>(self, f: F) -> Poll<Result<T, U>>
- where F: FnOnce(E) -> U;
-}
-
-impl<T, E> PollResultExt<T, E> for Poll<Result<T, E>> {
-
- fn map_ok<U, F>(self, f: F) -> Poll<Result<U, E>>
- where F: FnOnce(T) -> U
- {
- match self {
- Poll::Ready(Ok(t)) => Poll::Ready(Ok(f(t))),
- Poll::Ready(Err(e)) => Poll::Ready(Err(e)),
- Poll::Pending => Poll::Pending,
- }
- }
-
- fn map_err<U, F>(self, f: F) -> Poll<Result<T, U>>
- where F: FnOnce(E) -> U
- {
- match self {
- Poll::Ready(Ok(t)) => Poll::Ready(Ok(t)),
- Poll::Ready(Err(e)) => Poll::Ready(Err(f(e))),
- Poll::Pending => Poll::Pending,
- }
- }
-}
-
-
