diff options
Diffstat (limited to 'tokio-futures/src/macros.rs')
-rw-r--r-- | tokio-futures/src/macros.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tokio-futures/src/macros.rs b/tokio-futures/src/macros.rs new file mode 100644 index 00000000..30505ef1 --- /dev/null +++ b/tokio-futures/src/macros.rs @@ -0,0 +1,12 @@ +/// Unwrap a ready value or propagate `Async::Pending`. +#[macro_export] +macro_rules! ready { + ($e:expr) => {{ + use std::task::Poll::{Pending, Ready}; + + match $e { + Ready(v) => v, + Pending => return Pending, + } + }}; +} |