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.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl FromWasmAbi for Option<f32>

source§

type Abi = Option<f32>

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 = Option<i32>

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<isize>

source§

type Abi = Option<i32>

source§

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

source§

impl FromWasmAbi for Option<u32>

source§

type Abi = Option<u32>

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<usize>

source§

type Abi = Option<u32>

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 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 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§

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§