Skip to main content

IntoWasmAbi

Trait IntoWasmAbi 

Source
pub trait IntoWasmAbi: WasmDescribe {
    type Abi: WasmAbi;

    // Required method
    fn into_abi(self) -> Self::Abi;
}
Expand description

A trait for anything that can be converted into a type that can cross the Wasm ABI directly, eg u32 or f64.

This is the opposite of FromWasmAbi and Ref[Mut]FromWasmAbi.

§⚠️ Unstable

This is part of the internal convert module, no stability guarantees are provided. Use at your own risk. See its documentation for more details.

Required Associated Types§

Source

type Abi: WasmAbi

The Wasm ABI type that this converts into when crossing the ABI boundary.

Required Methods§

Source

fn into_abi(self) -> Self::Abi

Convert self into Self::Abi so that it can be sent across the wasm ABI boundary.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl IntoWasmAbi for &&Box<str>

Source§

type Abi = <&'static Box<str> as IntoWasmAbi>::Abi

Source§

fn into_abi(self) -> Self::Abi

Source§

impl IntoWasmAbi for &&Cow<'_, str>

Source§

type Abi = <&'static Cow<'static, str> as IntoWasmAbi>::Abi

Source§

fn into_abi(self) -> Self::Abi

Source§

impl IntoWasmAbi for &&String

Source§

type Abi = <&'static String as IntoWasmAbi>::Abi

Source§

fn into_abi(self) -> Self::Abi

Source§

impl IntoWasmAbi for &&str

Source§

type Abi = <&'static str as IntoWasmAbi>::Abi

Source§

fn into_abi(self) -> Self::Abi

Source§

impl IntoWasmAbi for &Box<str>

Source§

type Abi = <&'static str as IntoWasmAbi>::Abi

Source§

fn into_abi(self) -> Self::Abi

Source§

impl IntoWasmAbi for &Cow<'_, str>

Source§

type Abi = <&'static str as IntoWasmAbi>::Abi

Source§

fn into_abi(self) -> Self::Abi

Source§

impl IntoWasmAbi for &String

Source§

type Abi = <&'static str as IntoWasmAbi>::Abi

Source§

fn into_abi(self) -> Self::Abi

Source§

impl IntoWasmAbi for &bool

Source§

type Abi = <bool as IntoWasmAbi>::Abi

Source§

fn into_abi(self) -> Self::Abi

Source§

impl IntoWasmAbi for &char

Source§

type Abi = <char as IntoWasmAbi>::Abi

Source§

fn into_abi(self) -> Self::Abi

Source§

impl IntoWasmAbi for &f32

Source§

type Abi = <f32 as IntoWasmAbi>::Abi

Source§

fn into_abi(self) -> Self::Abi

Source§

impl IntoWasmAbi for &f64

Source§

type Abi = <f64 as IntoWasmAbi>::Abi

Source§

fn into_abi(self) -> Self::Abi

Source§

impl IntoWasmAbi for &i8

Source§

type Abi = <i8 as IntoWasmAbi>::Abi

Source§

fn into_abi(self) -> Self::Abi

Source§

impl IntoWasmAbi for &i16

Source§

type Abi = <i16 as IntoWasmAbi>::Abi

Source§

fn into_abi(self) -> Self::Abi

Source§

impl IntoWasmAbi for &i32

Source§

type Abi = <i32 as IntoWasmAbi>::Abi

Source§

fn into_abi(self) -> Self::Abi

Source§

impl IntoWasmAbi for &i64

Source§

type Abi = <i64 as IntoWasmAbi>::Abi

Source§

fn into_abi(self) -> Self::Abi

Source§

impl IntoWasmAbi for &i128

Source§

type Abi = <i128 as IntoWasmAbi>::Abi

Source§

fn into_abi(self) -> Self::Abi

Source§

impl IntoWasmAbi for &isize

Source§

type Abi = <isize as IntoWasmAbi>::Abi

Source§

fn into_abi(self) -> Self::Abi

Source§

impl IntoWasmAbi for &u8

Source§

type Abi = <u8 as IntoWasmAbi>::Abi

Source§

fn into_abi(self) -> Self::Abi

Source§

impl IntoWasmAbi for &u16

Source§

type Abi = <u16 as IntoWasmAbi>::Abi

Source§

fn into_abi(self) -> Self::Abi

Source§

impl IntoWasmAbi for &u32

Source§

type Abi = <u32 as IntoWasmAbi>::Abi

Source§

fn into_abi(self) -> Self::Abi

Source§

impl IntoWasmAbi for &u64

Source§

type Abi = <u64 as IntoWasmAbi>::Abi

Source§

fn into_abi(self) -> Self::Abi

Source§

impl IntoWasmAbi for &u128

Source§

type Abi = <u128 as IntoWasmAbi>::Abi

Source§

fn into_abi(self) -> Self::Abi

Source§

impl IntoWasmAbi for &usize

Source§

type Abi = <usize as IntoWasmAbi>::Abi

Source§

fn into_abi(self) -> Self::Abi

Source§

impl IntoWasmAbi for ()

Source§

impl IntoWasmAbi for String

Source§

type Abi = <Vec<u8> as IntoWasmAbi>::Abi

Source§

fn into_abi(self) -> Self::Abi

Source§

impl IntoWasmAbi for bool

Source§

impl IntoWasmAbi for char

Source§

impl IntoWasmAbi for f32

Source§

impl IntoWasmAbi for f64

Source§

impl IntoWasmAbi for i8

Source§

impl IntoWasmAbi for i16

Source§

impl IntoWasmAbi for i32

Source§

impl IntoWasmAbi for i64

Source§

impl IntoWasmAbi for i128

Source§

impl IntoWasmAbi for isize

Source§

type Abi = i32

Source§

fn into_abi(self) -> WasmSignedWordRepr

Source§

impl IntoWasmAbi for u8

Source§

impl IntoWasmAbi for u16

Source§

impl IntoWasmAbi for u32

Source§

impl IntoWasmAbi for u64

Source§

impl IntoWasmAbi for u128

Source§

impl IntoWasmAbi for usize

Source§

type Abi = u32

Source§

fn into_abi(self) -> WasmWordRepr

Source§

impl<'a, T: WasmDescribe> IntoWasmAbi for &'a Option<T>

Source§

type Abi = <Option<&'a T> as IntoWasmAbi>::Abi

Source§

fn into_abi(self) -> Self::Abi

Source§

impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<f32>]

Source§

impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<f64>]

Source§

impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<i8>]

Source§

impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<i16>]

Source§

impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<i32>]

Source§

impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<i64>]

Source§

impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<isize>]

Source§

impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<u8>]

Source§

impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<u16>]

Source§

impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<u32>]

Source§

impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<u64>]

Source§

impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<usize>]

Source§

impl<'a> IntoWasmAbi for &'a mut [f32]

Source§

impl<'a> IntoWasmAbi for &'a mut [f64]

Source§

impl<'a> IntoWasmAbi for &'a mut [i8]

Source§

impl<'a> IntoWasmAbi for &'a mut [i16]

Source§

impl<'a> IntoWasmAbi for &'a mut [i32]

Source§

impl<'a> IntoWasmAbi for &'a mut [i64]

Source§

impl<'a> IntoWasmAbi for &'a mut [isize]

Source§

impl<'a> IntoWasmAbi for &'a mut [u8]

Source§

impl<'a> IntoWasmAbi for &'a mut [u16]

Source§

impl<'a> IntoWasmAbi for &'a mut [u32]

Source§

impl<'a> IntoWasmAbi for &'a mut [u64]

Source§

impl<'a> IntoWasmAbi for &'a mut [usize]

Source§

impl<'a> IntoWasmAbi for &'a str

Source§

type Abi = <&'a [u8] as IntoWasmAbi>::Abi

Source§

fn into_abi(self) -> Self::Abi

Source§

impl<A, B, C, D, E, F, G, H, R> IntoWasmAbi for &(dyn Fn(A, B, C, D, E, F, G, H) -> R + '_)
where Self: WasmDescribe,

Source§

impl<A, B, C, D, E, F, G, H, R> IntoWasmAbi for &mut (dyn FnMut(A, B, C, D, E, F, G, H) -> R + '_)
where Self: WasmDescribe,

Source§

impl<A, B, C, D, E, F, G, R> IntoWasmAbi for &(dyn Fn(A, B, C, D, E, F, G) -> R + '_)
where Self: WasmDescribe,

Source§

impl<A, B, C, D, E, F, G, R> IntoWasmAbi for &mut (dyn FnMut(A, B, C, D, E, F, G) -> R + '_)
where Self: WasmDescribe,

Source§

impl<A, B, C, D, E, F, R> IntoWasmAbi for &(dyn Fn(A, B, C, D, E, F) -> R + '_)
where Self: WasmDescribe,

Source§

impl<A, B, C, D, E, F, R> IntoWasmAbi for &mut (dyn FnMut(A, B, C, D, E, F) -> R + '_)
where Self: WasmDescribe,

Source§

impl<A, B, C, D, E, R> IntoWasmAbi for &(dyn Fn(A, B, C, D, E) -> R + '_)
where Self: WasmDescribe,

Source§

impl<A, B, C, D, E, R> IntoWasmAbi for &mut (dyn FnMut(A, B, C, D, E) -> R + '_)
where Self: WasmDescribe,

Source§

impl<A, B, C, D, R> IntoWasmAbi for &(dyn Fn(A, B, C, D) -> R + '_)
where Self: WasmDescribe,

Source§

impl<A, B, C, D, R> IntoWasmAbi for &mut (dyn FnMut(A, B, C, D) -> R + '_)
where Self: WasmDescribe,

Source§

impl<A, B, C, R> IntoWasmAbi for &(dyn Fn(A, B, C) -> R + '_)
where Self: WasmDescribe,

Source§

impl<A, B, C, R> IntoWasmAbi for &mut (dyn FnMut(A, B, C) -> R + '_)
where Self: WasmDescribe,

Source§

impl<A, B, R> IntoWasmAbi for &(dyn Fn(A, B) -> R + '_)
where Self: WasmDescribe,

Source§

impl<A, B, R> IntoWasmAbi for &mut (dyn FnMut(A, B) -> R + '_)
where Self: WasmDescribe,

Source§

impl<A, R> IntoWasmAbi for &(dyn Fn(&A) -> R + '_)
where Self: WasmDescribe,

Source§

impl<A, R> IntoWasmAbi for &(dyn Fn(A) -> R + '_)
where Self: WasmDescribe,

Source§

impl<A, R> IntoWasmAbi for &mut (dyn FnMut(&A) -> R + '_)
where Self: WasmDescribe,

Source§

impl<A, R> IntoWasmAbi for &mut (dyn FnMut(A) -> R + '_)
where Self: WasmDescribe,

Source§

impl<R> IntoWasmAbi for &(dyn Fn() -> R + '_)
where Self: WasmDescribe,

Source§

impl<R> IntoWasmAbi for &mut (dyn FnMut() -> R + '_)
where Self: WasmDescribe,

Source§

impl<T: MaybeIntoWasmAbi> IntoWasmAbi for Option<T>

Source§

impl<T: VectorIntoWasmAbi> IntoWasmAbi for Box<[T]>

Source§

type Abi = <T as VectorIntoWasmAbi>::Abi

Source§

fn into_abi(self) -> Self::Abi

Source§

impl<T: VectorRefIntoWasmAbi> IntoWasmAbi for &[T]

Source§

impl<T> IntoWasmAbi for *const T

Source§

type Abi = u32

Source§

fn into_abi(self) -> Self::Abi

Source§

impl<T> IntoWasmAbi for *mut T

Source§

type Abi = u32

Source§

fn into_abi(self) -> Self::Abi

Source§

impl<T> IntoWasmAbi for NonNull<T>

Source§

type Abi = u32

Source§

fn into_abi(self) -> Self::Abi

Source§

impl<T> IntoWasmAbi for Vec<T>
where Box<[T]>: IntoWasmAbi<Abi = WasmSlice>,

Source§

type Abi = <Box<[T]> as IntoWasmAbi>::Abi

Source§

fn into_abi(self) -> Self::Abi

Implementors§

Source§

impl IntoWasmAbi for &JsValue

Source§

impl IntoWasmAbi for JsError

Source§

impl IntoWasmAbi for JsValue

Source§

impl IntoWasmAbi for Null

Source§

impl IntoWasmAbi for Undefined

Source§

impl<'__wbg_ref, T> IntoWasmAbi for &'__wbg_ref JsNullable<T>

Source§

type Abi = <&'__wbg_ref JsValue as IntoWasmAbi>::Abi

Source§

impl<'__wbg_ref, T> IntoWasmAbi for &'__wbg_ref JsOption<T>

Source§

type Abi = <&'__wbg_ref JsValue as IntoWasmAbi>::Abi

Source§

impl<'__wbg_ref> IntoWasmAbi for &'__wbg_ref Null

Source§

type Abi = <&'__wbg_ref JsValue as IntoWasmAbi>::Abi

Source§

impl<'__wbg_ref> IntoWasmAbi for &'__wbg_ref Undefined

Source§

type Abi = <&'__wbg_ref JsValue as IntoWasmAbi>::Abi

Source§

impl<'a, T: WasmDescribe> IntoWasmAbi for &'a Nullable<T>

Source§

impl<'a, T: WasmDescribe> IntoWasmAbi for Nullable<&'a Option<T>>

Source§

impl<T: IntoWasmAbi> IntoWasmAbi for Clamped<T>

Source§

type Abi = <T as IntoWasmAbi>::Abi

Source§

impl<T: NullableIntoWasmAbi> IntoWasmAbi for Nullable<Option<T>>

Nullable<Option<T>> shares T’s ABI, Null and None being its two spare values.

Source§

impl<T: NullableIntoWasmAbi> IntoWasmAbi for Nullable<T>

Source§

impl<T: SafeIntegerPrimitive> IntoWasmAbi for &SafeInteger<T>

Source§

impl<T: SafeIntegerPrimitive> IntoWasmAbi for SafeInteger<T>

Source§

impl<T> IntoWasmAbi for &ScopedClosure<'_, T>
where T: WasmClosure + ?Sized,

Source§

impl<T> IntoWasmAbi for JsNullable<T>

Source§

impl<T> IntoWasmAbi for JsOption<T>

Source§

impl<T> IntoWasmAbi for ScopedClosure<'static, T>
where T: WasmClosure + ?Sized,

'static closures can be passed by value to JS, transferring ownership.

This is useful for one-shot callbacks where you want JS to own the closure. The closure will be cleaned up by JS GC (if weak references are supported) or will leak (if weak references are not supported).

§Example

ⓘ
#[wasm_bindgen]
extern "C" {
    fn set_one_shot_callback(cb: Closure<dyn FnMut()>);
}

let cb = Closure::new(|| { /* ... */ });
set_one_shot_callback(cb);  // Ownership transferred to JS
// No need to store or forget the closure