Skip to main content

ToWasm

Trait ToWasm 

Source
pub trait ToWasm {
    type Wire;

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

A type that can be handed to JavaScript, crossing the ABI as Self::Wire.

Required Associated Types§

Source

type Wire

The type JavaScript actually receives.

Required Methods§

Source

fn to_wire(self) -> Result<Self::Wire, WireError>

Converts the Rust value into the wire value.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl ToWasm for ()

Available on crate feature wasm only.
Source§

impl ToWasm for JsValue

Available on crate feature wasm only.
Source§

impl ToWasm for String

Available on crate feature wasm only.
Source§

impl ToWasm for bool

Available on crate feature wasm only.
Source§

impl ToWasm for char

Available on crate feature wasm only.
Source§

impl ToWasm for f32

Available on crate feature wasm only.
Source§

impl ToWasm for f64

Available on crate feature wasm only.
Source§

impl ToWasm for i8

Available on crate feature wasm only.
Source§

impl ToWasm for i16

Available on crate feature wasm only.
Source§

impl ToWasm for i32

Available on crate feature wasm only.
Source§

impl ToWasm for i64

Available on crate feature wasm only.
Source§

impl ToWasm for i128

Available on crate feature wasm only.
Source§

impl ToWasm for isize

Available on crate feature wasm only.
Source§

impl ToWasm for u8

Available on crate feature wasm only.
Source§

impl ToWasm for u16

Available on crate feature wasm only.
Source§

impl ToWasm for u32

Available on crate feature wasm only.
Source§

impl ToWasm for u64

Available on crate feature wasm only.
Source§

impl ToWasm for u128

Available on crate feature wasm only.
Source§

impl ToWasm for usize

Available on crate feature wasm only.
Source§

impl<T: ToWasm> ToWasm for Option<T>

Source§

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

Source§

fn to_wire(self) -> Result<Self::Wire, WireError>

Source§

impl<T: ToWasm> ToWasm for Vec<T>

Source§

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

Source§

fn to_wire(self) -> Result<Self::Wire, WireError>

Implementors§