Crate wry_bindgen

Crate wry_bindgen 

Source
Expand description

wry-bindgen - Runtime support for wasm-bindgen-style bindings over Wry’s WebView

This crate provides the runtime types and traits needed for the #[wasm_bindgen] attribute macro to generate code that works with Wry’s IPC protocol.

§Architecture

The crate is organized into several modules:

  • encode - Core encoding/decoding traits for Rust types
  • function - JSFunction type for calling JavaScript functions
  • batch - Batching system for grouping multiple JS operations
  • runtime - Event loop and runtime management

Re-exports§

pub extern crate alloc;
pub use batch::batch;
pub use encode::BatchableResult;
pub use encode::BinaryDecode;
pub use encode::BinaryEncode;
pub use encode::EncodeTypeDef;
pub use function::JSFunction;
pub use inventory;

Modules§

__rt
Runtime module for wasm-bindgen compatibility. This module provides the wbg_cast function used for type casting.
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.
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
Link to a JS file for use with workers/worklets.

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

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§

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
The main wasm_bindgen attribute macro.