/// Returns `true` if this is `Poll::Ready`
#[inline]
+ #[rustc_const_stable(feature = "const_poll", since = "1.48.0")]
#[stable(feature = "futures_api", since = "1.36.0")]
- pub fn is_ready(&self) -> bool {
+ pub const fn is_ready(&self) -> bool {
matches!(*self, Poll::Ready(_))
}
/// Returns `true` if this is `Poll::Pending`
#[inline]
+ #[rustc_const_stable(feature = "const_poll", since = "1.48.0")]
#[stable(feature = "futures_api", since = "1.36.0")]
- pub fn is_pending(&self) -> bool {
+ pub const fn is_pending(&self) -> bool {
!self.is_ready()
}
}
--- /dev/null
+// run-pass
+
+use std::task::Poll;
+
+fn main() {
+ const POLL : Poll<usize> = Poll::Pending;
+
+ const IS_READY : bool = POLL.is_ready();
+ assert!(!IS_READY);
+
+ const IS_PENDING : bool = POLL.is_pending();
+ assert!(IS_PENDING);
+}