wasm_bindgen::convert

Trait FromWasmAbi

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

    // Required method
    unsafe fn from_abi(js: Self::Abi) -> Self;
}
Expand description

A trait for anything that can be recovered by-value from the Wasm ABI boundary, eg a Rust u8 can be recovered from the Wasm ABI u32 type.

This is the by-value variant of the opposite operation as IntoWasmAbi.

§⚠️ 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 from when coming back out from the ABI boundary.

Required Methods§

Source

unsafe fn from_abi(js: Self::Abi) -> Self

Recover a Self from Self::Abi.

§Safety

This is only safe to call when – and implementations may assume that – the supplied Self::Abi was previously generated by a call to <Self as IntoWasmAbi>::into_abi() or the moral equivalent in JS.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl FromWasmAbi for Option<f32>

Source§

type Abi = f64

Source§

unsafe fn from_abi(js: Self::Abi) -> Self

Source§

impl FromWasmAbi for Option<f64>

Source§

type Abi = Option<f64>

Source§

unsafe fn from_abi(js: Self::Abi) -> Self

Source§

impl FromWasmAbi for Option<i32>

Source§

type Abi = f64

Source§

unsafe fn from_abi(js: Self::Abi) -> Self

Source§

impl FromWasmAbi for Option<i64>

Source§

type Abi = Option<i64>

Source§

unsafe fn from_abi(js: Self::Abi) -> Self

Source§

impl FromWasmAbi for Option<i128>

Source§

type Abi = Option<i128>

Source§

unsafe fn from_abi(js: Self::Abi) -> Self

Source§

impl FromWasmAbi for Option<isize>

Source§

type Abi = f64

Source§

unsafe fn from_abi(js: Self::Abi) -> Self

Source§

impl FromWasmAbi for Option<u32>

Source§

type Abi = f64

Source§

unsafe fn from_abi(js: Self::Abi) -> Self

Source§

impl FromWasmAbi for Option<u64>

Source§

type Abi = Option<u64>

Source§

unsafe fn from_abi(js: Self::Abi) -> Self

Source§

impl FromWasmAbi for Option<u128>

Source§

type Abi = Option<u128>

Source§

unsafe fn from_abi(js: Self::Abi) -> Self

Source§

impl FromWasmAbi for Option<usize>

Source§

type Abi = f64

Source§

unsafe fn from_abi(js: Self::Abi) -> Self

Source§

impl FromWasmAbi for bool

Source§

type Abi = u32

Source§

unsafe fn from_abi(js: u32) -> bool

Source§

impl FromWasmAbi for char

Source§

type Abi = u32

Source§

unsafe fn from_abi(js: u32) -> char

Source§

impl FromWasmAbi for f32

Source§

type Abi = f32

Source§

unsafe fn from_abi(js: f32) -> Self

Source§

impl FromWasmAbi for f64

Source§

type Abi = f64

Source§

unsafe fn from_abi(js: f64) -> Self

Source§

impl FromWasmAbi for i8

Source§

type Abi = u32

Source§

unsafe fn from_abi(js: u32) -> Self

Source§

impl FromWasmAbi for i16

Source§

type Abi = u32

Source§

unsafe fn from_abi(js: u32) -> Self

Source§

impl FromWasmAbi for i32

Source§

type Abi = i32

Source§

unsafe fn from_abi(js: i32) -> Self

Source§

impl FromWasmAbi for i64

Source§

type Abi = i64

Source§

unsafe fn from_abi(js: i64) -> Self

Source§

impl FromWasmAbi for i128

Source§

type Abi = i128

Source§

unsafe fn from_abi(js: i128) -> Self

Source§

impl FromWasmAbi for isize

Source§

type Abi = i32

Source§

unsafe fn from_abi(js: i32) -> Self

Source§

impl FromWasmAbi for u8

Source§

type Abi = u32

Source§

unsafe fn from_abi(js: u32) -> Self

Source§

impl FromWasmAbi for u16

Source§

type Abi = u32

Source§

unsafe fn from_abi(js: u32) -> Self

Source§

impl FromWasmAbi for u32

Source§

type Abi = u32

Source§

unsafe fn from_abi(js: u32) -> Self

Source§

impl FromWasmAbi for u64

Source§

type Abi = u64

Source§

unsafe fn from_abi(js: u64) -> Self

Source§

impl FromWasmAbi for u128

Source§

type Abi = u128

Source§

unsafe fn from_abi(js: u128) -> Self

Source§

impl FromWasmAbi for usize

Source§

type Abi = u32

Source§

unsafe fn from_abi(js: u32) -> Self

Source§

impl FromWasmAbi for String

Source§

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

Source§

unsafe fn from_abi(js: Self::Abi) -> Self

Source§

impl<T> FromWasmAbi for Option<*const T>

Source§

impl<T> FromWasmAbi for Option<*mut T>

Source§

type Abi = f64

Source§

unsafe fn from_abi(js: f64) -> Option<*mut T>

Source§

impl<T> FromWasmAbi for *const T

Source§

type Abi = u32

Source§

unsafe fn from_abi(js: u32) -> *const T

Source§

impl<T> FromWasmAbi for *mut T

Source§

type Abi = u32

Source§

unsafe fn from_abi(js: u32) -> *mut T

Source§

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

Source§

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

Source§

unsafe fn from_abi(js: Self::Abi) -> Self

Source§

impl<T> FromWasmAbi for NonNull<T>

Source§

type Abi = u32

Source§

unsafe fn from_abi(js: Self::Abi) -> Self

Source§

impl<T: OptionFromWasmAbi> FromWasmAbi for Option<T>

Source§

type Abi = <T as FromWasmAbi>::Abi

Source§

unsafe fn from_abi(js: T::Abi) -> Self

Source§

impl<T: VectorFromWasmAbi> FromWasmAbi for Box<[T]>

Source§

type Abi = <T as VectorFromWasmAbi>::Abi

Source§

unsafe fn from_abi(js: Self::Abi) -> Self

Implementors§