wasm_bindgen::convert

Trait WasmPrimitive

Source
pub unsafe trait WasmPrimitive: Default { }
Expand description

A trait for any type which maps to a Wasm primitive type when used in FFI (i32, i64, f32, or f64).

This is with the exception of () (and other zero-sized types), which are also allowed because they’re ignored: no arguments actually get added.

§Safety

This is an unsafe trait to implement as there’s no guarantee the type actually maps to a primitive type.

§⚠️ 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.

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 WasmPrimitive for f32

Source§

impl WasmPrimitive for f64

Source§

impl WasmPrimitive for i32

Source§

impl WasmPrimitive for i64

Source§

impl WasmPrimitive for u32

Source§

impl WasmPrimitive for u64

Source§

impl WasmPrimitive for ()

Implementors§