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:

  • JsValue - Opaque references to JavaScript values
  • closure - Rust closures passed to JavaScript
  • convert - wasm-bindgen-compatible conversion marker traits
  • sys - JavaScript semantic helper types

Re-exports§

pub use closure::Closure;
pub use closure::ScopedClosure;
pub use convert::IntoJsGeneric;
pub use convert::JsGeneric;

Modules§

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.

Macros§

link_to
Link to a JS file for use with workers/worklets.

Structs§

Clamped
A wrapper type around slices and vectors for binding Uint8ClampedArray.
JsError
A JavaScript Error object.
JsStaticDeprecated
Legacy wrapper for imported statics.
JsThreadLocal
Backwards-compatible name used by generated thread_local_v2 bindings.
JsValue
An opaque reference to a JavaScript heap object.
LazyCell
A runtime-local accessor for lazily initialized JavaScript values.
Parent
Storage wrapper for the auto-injected parent field on extended Rust types.

Traits§

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 JS heap references.
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
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

Attribute Macros§

wasm_bindgen
The main wasm_bindgen attribute macro.