diff options
Diffstat (limited to 'src/component_future.rs')
-rw-r--r-- | src/component_future.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/component_future.rs b/src/component_future.rs index 4613b71..6d8449d 100644 --- a/src/component_future.rs +++ b/src/component_future.rs @@ -24,6 +24,18 @@ pub enum Async<Item> { NothingToDo, } +macro_rules! try_ready { + ($e:expr) => { + match $e { + Ok(futures::Async::Ready(t)) => t, + Ok(futures::Async::NotReady) => { + return Ok($crate::component_future::Async::NotReady) + } + Err(e) => return Err(From::from(e)), + } + }; +} + pub fn poll_future<T, Item, Error>( future: &mut T, poll_fns: &'static [&'static dyn for<'a> Fn( |