Skip to main content

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:

  • BinaryEncode/BinaryDecode - Core encoding/decoding traits for Rust types
  • JSFunction - JSFunction type for calling JavaScript functions
  • batch - Batching helpers for grouping multiple JS operations
  • wry - Event loop and Wry integration

Re-exports§

pub use closure::Closure;
pub use closure::ScopedClosure;
pub use convert::IntoJsGeneric;
pub use convert::JsGeneric;
pub use sys::JsOption;
pub use sys::Null;
pub use sys::Promising;
pub use sys::Undefined;

Modules§

batch
Batching system for grouping multiple JS operations into single messages.
closure
Closure compatibility types and traits.
convert
Conversion traits for wasm-bindgen API compatibility.
prelude
Prelude module for common imports
sys
JavaScript system value wrappers and promise compatibility traits.
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.
DecodedData
Decoded binary data with aligned buffer access.
EncodedData
Encoder for building binary messages.
JSFunction
A reference to a JavaScript function that can be called from Rust.
JsError
A JavaScript Error object.
JsStaticDeprecated
Legacy wrapper for imported statics.
JsThreadLocal
A thread-local accessor for lazily initialized JavaScript values.
JsValue
An opaque reference to a JavaScript heap object.
Parent
Storage wrapper for the auto-injected parent field on extended Rust types.
Ref
RefMut

Enums§

DecodeError
Error type for decoding binary IPC messages.

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.
ErasableGeneric
Marker for types whose generic parameters erase to one stable runtime representation.
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.

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.
function_table
Returns a handle to this Wasm instance’s WebAssembly.Table (indirect function table).
instance
Returns a handle to this Wasm instance’s WebAssembly.Instance.
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.