pub struct Promise { /* private fields */ }Implementations§
Source§impl Promise
impl Promise
pub fn new() -> Self
pub fn state(&self) -> PromiseState
pub fn set_poller(&self, poller: Rc<dyn Fn()>)
pub fn set_waiter(&self, waiter: Rc<dyn Fn()>)
pub fn set_cancel_hook(&self, cancel: Rc<dyn Fn()>)
pub fn wait_state(&self) -> PromiseState
pub fn wait_state_timeout(&self, timeout: Duration) -> PromiseState
pub fn cancel(&self) -> bool
pub fn schedule( &self, delay: Duration, task: Rc<dyn Fn() -> Result<Value, String>>, )
pub fn resolve(&self, value: Value) -> bool
pub fn reject(&self, error: impl Into<String>) -> bool
pub fn reject_value(&self, error: Value) -> bool
pub fn reject_rejection(&self, error: PromiseRejection) -> bool
pub fn on_settle(&self, continuation: Rc<dyn Fn(PromiseState)>)
pub fn adopt(&self, other: &Promise) -> bool
pub fn same_identity(&self, other: &Self) -> bool
pub fn identity_address(&self) -> usize
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Promise
impl !Send for Promise
impl !Sync for Promise
impl !UnwindSafe for Promise
impl Freeze for Promise
impl Unpin for Promise
impl UnsafeUnpin for Promise
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more