timer: finish updating timer (#1222)

* timer: restructure feature flags
* update timer tests
* Add `async-traits` to CI

This also disables a buggy `threadpool` test. This test should be fixed in the future.

Refs #1225
This commit is contained in:
Carl Lerche
2019-06-30 08:48:53 -07:00
committed by GitHub
parent 8e7d8af588
commit b2c777846e
27 changed files with 786 additions and 755 deletions
+6 -6
View File
@@ -6,8 +6,6 @@
use crate::clock::now;
use crate::Delay;
#[cfg(feature = "timeout-stream")]
use futures_core::Stream;
use std::fmt;
use std::future::Future;
use std::pin::Pin;
@@ -175,10 +173,10 @@ where
}
}
#[cfg(feature = "timeout-stream")]
impl<T> Stream for Timeout<T>
#[cfg(feature = "async-traits")]
impl<T> futures_core::Stream for Timeout<T>
where
T: Stream,
T: futures_core::Stream,
{
type Item = Result<T::Item, Elapsed>;
@@ -202,8 +200,10 @@ where
}
// Now check the timer
ready!(self.map_unchecked_mut(|me| &mut me.delay).poll(cx));
ready!(self.as_mut().map_unchecked_mut(|me| &mut me.delay).poll(cx));
// if delay was ready, timeout elapsed!
self.as_mut().get_unchecked_mut().delay.reset_timeout();
Poll::Ready(Some(Err(Elapsed(()))))
}
}