diff options
Diffstat (limited to 'third_party/rust/futures-core/src/task/poll.rs')
-rw-r--r-- | third_party/rust/futures-core/src/task/poll.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/third_party/rust/futures-core/src/task/poll.rs b/third_party/rust/futures-core/src/task/poll.rs new file mode 100644 index 0000000000..607e78e060 --- /dev/null +++ b/third_party/rust/futures-core/src/task/poll.rs @@ -0,0 +1,12 @@ +/// Extracts the successful type of a `Poll<T>`. +/// +/// This macro bakes in propagation of `Pending` signals by returning early. +#[macro_export] +macro_rules! ready { + ($e:expr $(,)?) => { + match $e { + $crate::task::Poll::Ready(t) => t, + $crate::task::Poll::Pending => return $crate::task::Poll::Pending, + } + }; +} |