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§
Required Methods§
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>
impl IntoWasmAbi for &&Box<str>
Source§impl IntoWasmAbi for &&Cow<'_, str>
impl IntoWasmAbi for &&Cow<'_, str>
Source§impl IntoWasmAbi for &&String
impl IntoWasmAbi for &&String
Source§impl IntoWasmAbi for &&str
impl IntoWasmAbi for &&str
Source§impl IntoWasmAbi for &Box<str>
impl IntoWasmAbi for &Box<str>
Source§impl IntoWasmAbi for &Cow<'_, str>
impl IntoWasmAbi for &Cow<'_, str>
Source§impl IntoWasmAbi for &String
impl IntoWasmAbi for &String
Source§impl IntoWasmAbi for &bool
impl IntoWasmAbi for &bool
Source§impl IntoWasmAbi for &char
impl IntoWasmAbi for &char
Source§impl IntoWasmAbi for &f32
impl IntoWasmAbi for &f32
Source§impl IntoWasmAbi for &f64
impl IntoWasmAbi for &f64
Source§impl IntoWasmAbi for &i8
impl IntoWasmAbi for &i8
Source§impl IntoWasmAbi for &i16
impl IntoWasmAbi for &i16
Source§impl IntoWasmAbi for &i32
impl IntoWasmAbi for &i32
Source§impl IntoWasmAbi for &i64
impl IntoWasmAbi for &i64
Source§impl IntoWasmAbi for &i128
impl IntoWasmAbi for &i128
Source§impl IntoWasmAbi for &isize
impl IntoWasmAbi for &isize
Source§impl IntoWasmAbi for &u8
impl IntoWasmAbi for &u8
Source§impl IntoWasmAbi for &u16
impl IntoWasmAbi for &u16
Source§impl IntoWasmAbi for &u32
impl IntoWasmAbi for &u32
Source§impl IntoWasmAbi for &u64
impl IntoWasmAbi for &u64
Source§impl IntoWasmAbi for &u128
impl IntoWasmAbi for &u128
Source§impl IntoWasmAbi for &usize
impl IntoWasmAbi for &usize
Source§impl IntoWasmAbi for String
impl IntoWasmAbi for String
Source§impl IntoWasmAbi for isize
impl IntoWasmAbi for isize
Source§impl<'a, T: WasmDescribe> IntoWasmAbi for &'a Option<T>
impl<'a, T: WasmDescribe> IntoWasmAbi for &'a Option<T>
Source§impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<f32>]
impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<f32>]
Source§impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<f64>]
impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<f64>]
Source§impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<i8>]
impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<i8>]
Source§impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<i16>]
impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<i16>]
Source§impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<i32>]
impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<i32>]
Source§impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<i64>]
impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<i64>]
Source§impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<isize>]
impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<isize>]
Source§impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<u8>]
impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<u8>]
Source§impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<u16>]
impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<u16>]
Source§impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<u32>]
impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<u32>]
Source§impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<u64>]
impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<u64>]
Source§impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<usize>]
impl<'a> IntoWasmAbi for &'a mut [MaybeUninit<usize>]
Source§impl<'a> IntoWasmAbi for &'a mut [f32]
impl<'a> IntoWasmAbi for &'a mut [f32]
Source§impl<'a> IntoWasmAbi for &'a mut [f64]
impl<'a> IntoWasmAbi for &'a mut [f64]
Source§impl<'a> IntoWasmAbi for &'a mut [i8]
impl<'a> IntoWasmAbi for &'a mut [i8]
Source§impl<'a> IntoWasmAbi for &'a mut [i16]
impl<'a> IntoWasmAbi for &'a mut [i16]
Source§impl<'a> IntoWasmAbi for &'a mut [i32]
impl<'a> IntoWasmAbi for &'a mut [i32]
Source§impl<'a> IntoWasmAbi for &'a mut [i64]
impl<'a> IntoWasmAbi for &'a mut [i64]
Source§impl<'a> IntoWasmAbi for &'a mut [isize]
impl<'a> IntoWasmAbi for &'a mut [isize]
Source§impl<'a> IntoWasmAbi for &'a mut [u8]
impl<'a> IntoWasmAbi for &'a mut [u8]
Source§impl<'a> IntoWasmAbi for &'a mut [u16]
impl<'a> IntoWasmAbi for &'a mut [u16]
Source§impl<'a> IntoWasmAbi for &'a mut [u32]
impl<'a> IntoWasmAbi for &'a mut [u32]
Source§impl<'a> IntoWasmAbi for &'a mut [u64]
impl<'a> IntoWasmAbi for &'a mut [u64]
Source§impl<'a> IntoWasmAbi for &'a mut [usize]
impl<'a> IntoWasmAbi for &'a mut [usize]
Source§impl<'a> IntoWasmAbi for &'a str
impl<'a> IntoWasmAbi for &'a str
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
impl<A, R> IntoWasmAbi for &mut (dyn FnMut(A) -> R + '_)where
Self: WasmDescribe,
Source§impl<R> IntoWasmAbi for &(dyn Fn() -> R + '_)where
Self: WasmDescribe,
impl<R> IntoWasmAbi for &(dyn Fn() -> R + '_)where
Self: WasmDescribe,
Source§impl<R> IntoWasmAbi for &mut (dyn FnMut() -> R + '_)where
Self: WasmDescribe,
impl<R> IntoWasmAbi for &mut (dyn FnMut() -> R + '_)where
Self: WasmDescribe,
Source§impl<T: MaybeIntoWasmAbi> IntoWasmAbi for Option<T>
impl<T: MaybeIntoWasmAbi> IntoWasmAbi for Option<T>
Source§impl<T: VectorIntoWasmAbi> IntoWasmAbi for Box<[T]>
impl<T: VectorIntoWasmAbi> IntoWasmAbi for Box<[T]>
Source§impl<T: VectorRefIntoWasmAbi> IntoWasmAbi for &[T]
impl<T: VectorRefIntoWasmAbi> IntoWasmAbi for &[T]
Source§impl<T> IntoWasmAbi for Vec<T>
impl<T> IntoWasmAbi for Vec<T>
Implementors§
Source§impl IntoWasmAbi for JsError
impl IntoWasmAbi for JsError
Source§impl IntoWasmAbi for Null
impl IntoWasmAbi for Null
Source§impl IntoWasmAbi for Undefined
impl IntoWasmAbi for Undefined
Source§impl<'__wbg_ref, T> IntoWasmAbi for &'__wbg_ref JsNullable<T>
impl<'__wbg_ref, T> IntoWasmAbi for &'__wbg_ref JsNullable<T>
Source§impl<'__wbg_ref, T> IntoWasmAbi for &'__wbg_ref JsOption<T>
impl<'__wbg_ref, T> IntoWasmAbi for &'__wbg_ref JsOption<T>
Source§impl<'__wbg_ref> IntoWasmAbi for &'__wbg_ref Null
impl<'__wbg_ref> IntoWasmAbi for &'__wbg_ref Null
Source§impl<'__wbg_ref> IntoWasmAbi for &'__wbg_ref Undefined
impl<'__wbg_ref> IntoWasmAbi for &'__wbg_ref Undefined
Source§impl<'a, T: WasmDescribe> IntoWasmAbi for &'a Nullable<T>
impl<'a, T: WasmDescribe> IntoWasmAbi for &'a Nullable<T>
Source§impl<'a, T: WasmDescribe> IntoWasmAbi for Nullable<&'a Option<T>>
impl<'a, T: WasmDescribe> IntoWasmAbi for Nullable<&'a Option<T>>
Source§impl<T: IntoWasmAbi> IntoWasmAbi for Clamped<T>
impl<T: IntoWasmAbi> IntoWasmAbi for Clamped<T>
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.
impl<T: NullableIntoWasmAbi> IntoWasmAbi for Nullable<Option<T>>
Nullable<Option<T>> shares T’s ABI, Null and None being its two
spare values.
type Abi = <T as MaybeIntoWasmAbi>::MaybeAbi
Source§impl<T: NullableIntoWasmAbi> IntoWasmAbi for Nullable<T>
impl<T: NullableIntoWasmAbi> IntoWasmAbi for Nullable<T>
type Abi = <T as MaybeIntoWasmAbi>::MaybeAbi
Source§impl<T: SafeIntegerPrimitive> IntoWasmAbi for &SafeInteger<T>
impl<T: SafeIntegerPrimitive> IntoWasmAbi for &SafeInteger<T>
Source§impl<T: SafeIntegerPrimitive> IntoWasmAbi for SafeInteger<T>
impl<T: SafeIntegerPrimitive> IntoWasmAbi for SafeInteger<T>
Source§impl<T> IntoWasmAbi for &ScopedClosure<'_, T>where
T: WasmClosure + ?Sized,
impl<T> IntoWasmAbi for &ScopedClosure<'_, T>where
T: WasmClosure + ?Sized,
Source§impl<T> IntoWasmAbi for JsNullable<T>
impl<T> IntoWasmAbi for JsNullable<T>
Source§impl<T> IntoWasmAbi for JsOption<T>
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.
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