Skip to main content

ps_promise/methods/
ready.rs

1use std::task::Context;
2
3use crate::{Promise, PromiseRejection};
4
5impl<T, E> Promise<T, E>
6where
7    T: Unpin,
8    E: PromiseRejection,
9{
10    /// Polls the promise's inner future if pending.
11    /// Returns `true` if the promise is now resolved or rejected.
12    pub fn ready(&mut self, cx: &mut Context<'_>) -> bool {
13        self.poll(cx);
14
15        self.is_ready()
16    }
17}