pub struct JsFuture<T = JsValue, E = JsValue> { /* private fields */ }Expand description
A Rust Future backed by a JavaScript Promise.
This type is constructed with a JavaScript Promise object and translates
it to a Rust Future. This type implements the Future trait from the
futures crate and will either succeed or fail depending on what happens
with the JavaScript Promise.
A JsFuture<T, E> built from a Promise<T, E> resolves to
Result<T, E>: the fulfilled value is converted as a T and the
rejection reason as an E, both unchecked, just as JS could have
settled the promise with anything.
Currently this type is constructed with JsFuture::from.
Trait Implementations§
Source§impl<T, E> ErasableGeneric for JsFuture<T, E>
impl<T, E> ErasableGeneric for JsFuture<T, E>
Source§impl<T: FromWasmAbi + 'static, E: FromWasmAbi + 'static> From<Promise<T, E>> for JsFuture<T, E>
impl<T: FromWasmAbi + 'static, E: FromWasmAbi + 'static> From<Promise<T, E>> for JsFuture<T, E>
impl<T: UnwindSafe, E: UnwindSafe> UnwindSafe for JsFuture<T, E>
Source§impl<T, E, Target, ErrTarget> Upcast<JsFuture<Target, ErrTarget>> for JsFuture<T, E>
impl<T, E, Target, ErrTarget> Upcast<JsFuture<Target, ErrTarget>> for JsFuture<T, E>
Auto Trait Implementations§
impl<T = JsValue, E = JsValue> !RefUnwindSafe for JsFuture<T, E>
impl<T = JsValue, E = JsValue> !Send for JsFuture<T, E>
impl<T = JsValue, E = JsValue> !Sync for JsFuture<T, E>
impl<T, E> Freeze for JsFuture<T, E>
impl<T, E> Unpin for JsFuture<T, E>
impl<T, E> UnsafeUnpin for JsFuture<T, E>
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
Source§impl<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
Source§type IntoFuture = F
type IntoFuture = F
Which kind of future are we turning this into?
Source§fn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
Creates a future from a value. Read more