Struct JsFuture

pub struct JsFuture<T = JsValue> { /* private fields */ }

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.

Currently this type is constructed with JsFuture::from.

Trait Implementations

impl UnwindSafe for JsFuture

impl<T> Debug for JsFuture<T>

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl<T> ErasableGeneric for JsFuture<T>

type Repr = JsFuture;

impl<T> Future for JsFuture<T>

type Output = Result<T, JsValue>;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output>

impl<T, Target> Upcast<JsFuture<Target>> for JsFuture<T> where T: Upcast<Target>,

impl<T: FromWasmAbi + 'static> From<Promise<T>> for JsFuture<T>

fn from(js: Promise<T>) -> JsFuture<T>

Auto Trait Implementations

impl<T = JsValue> !RefUnwindSafe for JsFuture<T>

impl<T = JsValue> !Send for JsFuture<T>

impl<T = JsValue> !Sync for JsFuture<T>

impl<T> Freeze for JsFuture<T> where Rc<RefCell<Inner<T>>>: Freeze,

impl<T> Unpin for JsFuture<T> where Rc<RefCell<Inner<T>>>: Unpin,

impl<T> UnsafeUnpin for JsFuture<T> where Rc<RefCell<Inner<T>>>: UnsafeUnpin,

Blanket Implementations

impl<F> IntoFuture for JsFuture<T> where F: Future,

impl<S, T> Upcast<T> for JsFuture<T> where T: UpcastFrom<S> + ?Sized, S: ?Sized,

impl<T> Any for JsFuture<T> where T: 'static + ?Sized,

impl<T> Borrow<T> for JsFuture<T> where T: ?Sized,

impl<T> BorrowMut<T> for JsFuture<T> where T: ?Sized,

impl<T> From<T> for JsFuture<T>

impl<T, U> Into<U> for JsFuture<T> where U: From<T>,

impl<T, U> TryFrom<U> for JsFuture<T> where U: Into<T>,

impl<T, U> TryInto<U> for JsFuture<T> where U: TryFrom<T>,