Crate wasm_bindgen_x

Crate wasm_bindgen_x 

Source
Expand description

Unified wasm-bindgen shim crate

This crate transparently re-exports either:

  • wry-bindgen-core for desktop targets (non-wasm32)
  • wasm-bindgen for wasm32 targets

The #[wasm_bindgen] macro is a shim that expands to both implementations wrapped in cfg-conditional modules.

Modules§

__rt
Runtime module for wasm-bindgen compatibility. This module provides the wbg_cast function used for type casting.
alloc
The Rust core allocation and collections library
batch
Batching system for grouping multiple JS operations into single messages.
closure
Re-export of the Closure type for wasm-bindgen API compatibility. Allows use wasm_bindgen::closure::Closure;
convert
Conversion traits for wasm-bindgen API compatibility.
encode
Core encoding and decoding traits for the binary protocol.
function
JavaScript function references and Rust callback management.
inventory
githubcrates-iodocs-rs
prelude
Prelude module for common imports
runtime
Runtime setup and event loop management.
wry
Reusable wry-bindgen state for integrating with existing wry applications.

Macros§

link_to
The link_to proc-macro for JavaScript module linking.

Structs§

Clamped
A wrapper type around slices and vectors for binding the Uint8ClampedArray in JS.
Closure
Closure type for passing Rust closures to JavaScript.
DecodedData
Decoded binary data with aligned buffer access.
EncodedData
Encoder for building binary messages.
InlineJsModule
Inline JS module info
JSFunction
A reference to a JavaScript function that can be called from Rust.
JsClassMemberSpec
Specification for a member of an exported Rust class
JsError
A JavaScript Error object.
JsExportSpec
Specification for an exported Rust function/method callable from JavaScript.
JsFunctionSpec
Function specification for the registry
JsThreadLocal
A thread-local accessor for lazily initialized JavaScript values.
JsValue
An opaque reference to a JavaScript heap object.
LazyJsFunction
A type that dynamically resolves to a JSFunction from the registry on first use.

Enums§

DecodeError
Error type for decoding binary IPC messages.
JsClassMemberKind
Type of class member for exported Rust structs

Traits§

BatchableResult
Trait for return types that can be used in batched JS calls. Determines how the type behaves during batching.
BinaryDecode
Trait for decoding values from the binary protocol. Each type specifies how to deserialize itself.
BinaryEncode
Trait for encoding Rust values into the binary protocol. Each type specifies how to serialize itself.
EncodeTypeDef
Trait for types that can encode their type definition into the binary protocol. This is used to send type information to JavaScript for callback arguments.
JsCast
Trait for types that can be cast to and from JsValue.
UnwrapThrowExt
Extension trait for Option to unwrap or throw a JS error. This is API-compatible with wasm-bindgen’s UnwrapThrowExt.
WasmClosure
Trait for closure types that can be wrapped and passed to JavaScript. This trait is implemented for all dyn FnMut(...) variants.

Functions§

batch
Execute operations inside a batch. Operations that return opaque types (like JsValue) will be batched and executed together. Operations that return non-opaque types will flush the batch to get the actual result.
exports
Returns a handle to this Wasm instance’s WebAssembly.Instance.prototype.exports.
externref_heap_live_count
Returns the number of live externref objects.
extract_rust_handle
function_table
Returns a handle to this Wasm instance’s WebAssembly.Table (indirect function table).
intern
Interns Rust strings so that it’s much faster to send them to JS.
memory
Returns a handle to this Wasm instance’s WebAssembly.Memory.
module
Returns a handle to this Wasm instance’s WebAssembly.Module.
throw_str
Throw a JS exception with the given message.
throw_val
unintern
Removes a Rust string from the intern cache.

Attribute Macros§

__wasm_bindgen_class_marker
Internal class marker macro for impl method expansion.
wasm_bindgen
The main wasm_bindgen attribute macro.