Skip to main content

FromWasm

Trait FromWasm 

Source
pub trait FromWasm: Sized {
    type Wire;

    // Required method
    fn from_wire(wire: Self::Wire) -> Result<Self, WireError>;
}
Expand description

A type that can be received from JavaScript, crossing the ABI as Self::Wire.

Required Associated Types§

Source

type Wire

The type JavaScript actually passes.

Required Methods§

Source

fn from_wire(wire: Self::Wire) -> Result<Self, WireError>

Recovers the Rust value from the wire value.

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 FromWasm for ()

Available on crate feature wasm only.
Source§

type Wire = ()

Source§

fn from_wire(wire: Self::Wire) -> Result<Self, WireError>

Source§

impl FromWasm for JsValue

Available on crate feature wasm only.
Source§

type Wire = JsValue

Source§

fn from_wire(wire: Self::Wire) -> Result<Self, WireError>

Source§

impl FromWasm for String

Available on crate feature wasm only.
Source§

type Wire = String

Source§

fn from_wire(wire: Self::Wire) -> Result<Self, WireError>

Source§

impl FromWasm for bool

Available on crate feature wasm only.
Source§

type Wire = bool

Source§

fn from_wire(wire: Self::Wire) -> Result<Self, WireError>

Source§

impl FromWasm for char

Available on crate feature wasm only.
Source§

type Wire = char

Source§

fn from_wire(wire: Self::Wire) -> Result<Self, WireError>

Source§

impl FromWasm for f32

Available on crate feature wasm only.
Source§

type Wire = f32

Source§

fn from_wire(wire: Self::Wire) -> Result<Self, WireError>

Source§

impl FromWasm for f64

Available on crate feature wasm only.
Source§

type Wire = f64

Source§

fn from_wire(wire: Self::Wire) -> Result<Self, WireError>

Source§

impl FromWasm for i8

Available on crate feature wasm only.
Source§

type Wire = i8

Source§

fn from_wire(wire: Self::Wire) -> Result<Self, WireError>

Source§

impl FromWasm for i16

Available on crate feature wasm only.
Source§

type Wire = i16

Source§

fn from_wire(wire: Self::Wire) -> Result<Self, WireError>

Source§

impl FromWasm for i32

Available on crate feature wasm only.
Source§

type Wire = i32

Source§

fn from_wire(wire: Self::Wire) -> Result<Self, WireError>

Source§

impl FromWasm for i64

Available on crate feature wasm only.
Source§

type Wire = i64

Source§

fn from_wire(wire: Self::Wire) -> Result<Self, WireError>

Source§

impl FromWasm for i128

Available on crate feature wasm only.
Source§

type Wire = i128

Source§

fn from_wire(wire: Self::Wire) -> Result<Self, WireError>

Source§

impl FromWasm for isize

Available on crate feature wasm only.
Source§

type Wire = isize

Source§

fn from_wire(wire: Self::Wire) -> Result<Self, WireError>

Source§

impl FromWasm for u8

Available on crate feature wasm only.
Source§

type Wire = u8

Source§

fn from_wire(wire: Self::Wire) -> Result<Self, WireError>

Source§

impl FromWasm for u16

Available on crate feature wasm only.
Source§

type Wire = u16

Source§

fn from_wire(wire: Self::Wire) -> Result<Self, WireError>

Source§

impl FromWasm for u32

Available on crate feature wasm only.
Source§

type Wire = u32

Source§

fn from_wire(wire: Self::Wire) -> Result<Self, WireError>

Source§

impl FromWasm for u64

Available on crate feature wasm only.
Source§

type Wire = u64

Source§

fn from_wire(wire: Self::Wire) -> Result<Self, WireError>

Source§

impl FromWasm for u128

Available on crate feature wasm only.
Source§

type Wire = u128

Source§

fn from_wire(wire: Self::Wire) -> Result<Self, WireError>

Source§

impl FromWasm for usize

Available on crate feature wasm only.
Source§

type Wire = usize

Source§

fn from_wire(wire: Self::Wire) -> Result<Self, WireError>

Source§

impl<T: FromWasm> FromWasm for Option<T>

Source§

type Wire = Option<<T as FromWasm>::Wire>

Source§

fn from_wire(wire: Self::Wire) -> Result<Self, WireError>

Source§

impl<T: FromWasm> FromWasm for Vec<T>

Vec<T> crosses as a vector of T’s wire type, so Vec<u8> stays Vec<u8> and reaches JavaScript as a Uint8Array.

Source§

type Wire = Vec<<T as FromWasm>::Wire>

Source§

fn from_wire(wire: Self::Wire) -> Result<Self, WireError>

Implementors§