Struct Suspending

#[repr(transparent)]
pub struct Suspending { /* private fields */ }

A WebAssembly.Suspending object wraps a JavaScript async function so it can be used as a WebAssembly import under JSPI (JS Promise Integration).

When WASM calls a Suspending-wrapped import that returns a Promise, the WASM fiber suspends until the promise settles; the resolved value is then returned to WASM as if the call had returned synchronously. The browser's event loop is not blocked.

MDN documentation

Implementations

impl Suspending

fn new(func: &Function) -> Suspending

Wraps func (an async function) in a WebAssembly.Suspending object.

Pass the returned object as a WASM import. Every call to that import from WASM will suspend the current fiber and resume it with the resolved value once func's returned Promise settles.

Trait Implementations

impl AsRef<JsValue> for Suspending

fn as_ref(&self) -> &JsValue

impl AsRef<Object> for Suspending

fn as_ref(&self) -> &Object

impl AsRef<Suspending> for Suspending

fn as_ref(&self) -> &Suspending

impl Clone for Suspending

fn clone(&self) -> Self

impl Debug for Suspending

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

impl Deref for Suspending

type Target = Object;
fn deref(&self) -> &Object

impl Eq for Suspending

impl ErasableGeneric for Suspending

type Repr = JsValue;

impl From<JsValue> for Suspending

fn from(obj: JsValue) -> Self

impl FromWasmAbi for Suspending

type Abi = <JsValue as FromWasmAbi>::Abi;
unsafe fn from_abi(js: Self::Abi) -> Self

impl IntoJsGeneric for Suspending where Suspending: JsGeneric,

type JsCanon = Suspending;
fn to_js(self) -> Suspending

impl IntoWasmAbi for Suspending

type Abi = <JsValue as IntoWasmAbi>::Abi;
fn into_abi(self) -> Self::Abi

impl JsCast for Suspending

fn instanceof(val: &JsValue) -> bool
fn unchecked_from_js(val: JsValue) -> Self
fn unchecked_from_js_ref(val: &JsValue) -> &Self

impl LongRefFromWasmAbi for Suspending

type Abi = <JsValue as LongRefFromWasmAbi>::Abi;
type Anchor = Suspending;
unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor

impl OptionFromWasmAbi for Suspending

fn is_none(abi: &Self::Abi) -> bool

impl OptionIntoWasmAbi for Suspending

fn none() -> Self::Abi

impl PartialEq for Suspending

fn eq(&self, other: &Self) -> bool

impl Promising for Suspending

type Resolution = Suspending;

impl RefFromWasmAbi for Suspending

type Abi = <JsValue as RefFromWasmAbi>::Abi;
type Anchor = ManuallyDrop<Suspending>;
unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor

impl StructuralPartialEq for Suspending

impl UpcastFrom<Suspending> for Suspending

impl WasmDescribe for Suspending

fn describe()

Auto Trait Implementations

impl Freeze for Suspending

impl RefUnwindSafe for Suspending

impl Send for Suspending

impl Sync for Suspending

impl Unpin for Suspending

impl UnsafeUnpin for Suspending

impl UnwindSafe for Suspending

Blanket Implementations

impl<P, T> Receiver for Suspending where P: Deref<Target = T> + ?Sized, T: ?Sized,

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

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

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

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

impl<T> CloneToUninit for Suspending where T: Clone,

impl<T> From<T> for Suspending

impl<T> JsGeneric for Suspending where T: ErasableGeneric<Repr = JsValue> + UpcastFrom<T> + Upcast<JsValue> + JsCast + 'static,

impl<T> ReturnWasmAbi for Suspending where T: IntoWasmAbi,

impl<T> ToOwned for Suspending where T: Clone,

impl<T> TryFromJsValue for Suspending where T: JsCast,

impl<T> VectorFromWasmAbi for Suspending where T: ErasableGeneric<Repr = JsValue> + WasmDescribe,

impl<T> VectorIntoWasmAbi for Suspending where T: ErasableGeneric<Repr = JsValue> + WasmDescribe,

impl<T> VectorRefIntoWasmAbi for Suspending where &'a T: for<'a> Into<JsValue>,

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

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

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