Crate hotdrink_wasm[][src]

A wrapper library around hotdrink-rs for compilation to WebAssembly.

Prerequisites

The project uses multiple nightly features, and must be built using nightly Rust. I recommend using rustup, which can be downloaded here,

You also need wasm-pack, which can be downloaded here.

The standard library must be recompiled, which means that we need the standard library source code. This can be downloaded with rustup component add rust-src.

Build

To use Web Workers from Rust, the we must compile with --target no-modules. This should be as simple as running the following:

wasm-pack build --out-dir www/pkg --target no-modules --release

This will produce WebAssembly code and JS wrappers in www/pkg, which can then be imported there.

Modules

event

Types for listening to and reacting to events.

macros

Macros for generating constraint system wrappers that can be used from JavaScript, and values that can be used within them.

thread

Thread pool implementations and wrappers around Web Workers to allow them to run Rust-functions.

util

Utility types and functions.

Macros

component_type_wrapper

Generate a WebAssembly wrapper around an inner type to use in a constraint system. component_type_wrapper! is to a constraint system made with constraint_system_wrapper!, as component_type! is to ConstraintSystem.

constraint_system_wrapper

A macro for generating a ConstraintSystem that can be compiled to WebAssembly.