All Projects → rustwasm → Wasm Bindgen

rustwasm / Wasm Bindgen

Licence: other
Facilitating high-level interactions between Wasm modules and JavaScript

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Wasm Bindgen

Wasm Pack
This tool seeks to be a one-stop shop for building and working with rust- generated WebAssembly that you would like to interop with JavaScript, in the browser or with Node.js. wasm-pack helps you build rust-generated WebAssembly packages that you could publish to the npm registry, or otherwise use alongside any javascript packages in workflows that you already use, such as webpack.
Stars: ✭ 3,848 (-18.04%)
Mutual labels:  wasm, rust-wasm
Trunk
Build, bundle & ship your Rust WASM application to the web.
Stars: ✭ 378 (-91.95%)
Mutual labels:  wasm
Wasm Util
WebAssembly utilities
Stars: ✭ 313 (-93.33%)
Mutual labels:  wasm
React Wasm
Declarative WebAssembly instantiation for React
Stars: ✭ 349 (-92.57%)
Mutual labels:  wasm
Awesome Wasi
😎 Curated list of awesome things regarding WebAssembly WASI ecosystem.
Stars: ✭ 319 (-93.21%)
Mutual labels:  wasm
Wac
WebAssembly interpreter in C
Stars: ✭ 372 (-92.08%)
Mutual labels:  wasm
Highway
Performance-portable, length-agnostic SIMD with runtime dispatch
Stars: ✭ 301 (-93.59%)
Mutual labels:  wasm
Bootstrapblazor
A set of enterprise-class UI components based on Bootstrap and Blazor
Stars: ✭ 403 (-91.42%)
Mutual labels:  wasm
Ffmpeg.wasm
FFmpeg for browser and node, powered by WebAssembly
Stars: ✭ 6,566 (+39.85%)
Mutual labels:  wasm
Nimtorch
PyTorch - Python + Nim
Stars: ✭ 346 (-92.63%)
Mutual labels:  wasm
Unrust
unrust - A pure rust based (webgl 2.0 / native) game engine
Stars: ✭ 341 (-92.74%)
Mutual labels:  wasm
Platon Go
Golang implementation of the PlatON protocol
Stars: ✭ 331 (-92.95%)
Mutual labels:  wasm
Lys
⚜︎ A language that compiles to WebAssembly
Stars: ✭ 375 (-92.01%)
Mutual labels:  wasm
Parity Wasm
WebAssembly serialization/deserialization in rust
Stars: ✭ 314 (-93.31%)
Mutual labels:  wasm
Wee alloc
The Wasm-Enabled, Elfin Allocator
Stars: ✭ 399 (-91.5%)
Mutual labels:  wasm
Pigo
Fast face detection, pupil/eyes localization and facial landmark points detection library in pure Go.
Stars: ✭ 3,542 (-24.56%)
Mutual labels:  wasm
Awesome Yew
😎 A curated list of awesome things related to Yew / WebAssembly.
Stars: ✭ 353 (-92.48%)
Mutual labels:  wasm
Ink
Parity's ink! to write smart contracts
Stars: ✭ 407 (-91.33%)
Mutual labels:  wasm
Rustynes
👾 An NES emulator by Rust and WebAssembly
Stars: ✭ 399 (-91.5%)
Mutual labels:  wasm
Lucet
Lucet, the Sandboxing WebAssembly Compiler.
Stars: ✭ 4,006 (-14.68%)
Mutual labels:  wasm

wasm-bindgen

Facilitating high-level interactions between Wasm modules and JavaScript.

Build Status Crates.io version Download docs.rs docs

Guide | API Docs | Contributing | Chat

Built with 🦀🕸 by The Rust and WebAssembly Working Group

Example

Import JavaScript things into Rust and export Rust things to JavaScript.

use wasm_bindgen::prelude::*;

// Import the `window.alert` function from the Web.
#[wasm_bindgen]
extern "C" {
    fn alert(s: &str);
}

// Export a `greet` function from Rust to JavaScript, that alerts a
// hello message.
#[wasm_bindgen]
pub fn greet(name: &str) {
    alert(&format!("Hello, {}!", name));
}

Use exported Rust things from JavaScript with ECMAScript modules!

import { greet } from "./hello_world";

greet("World!");

Features

  • Lightweight. Only pay for what you use. wasm-bindgen only generates bindings and glue for the JavaScript imports you actually use and Rust functionality that you export. For example, importing and using the document.querySelector method doesn't cause Node.prototype.appendChild or window.alert to be included in the bindings as well.

  • ECMAScript modules. Just import WebAssembly modules the same way you would import JavaScript modules. Future compatible with WebAssembly modules and ECMAScript modules integration.

  • Designed with the "Web IDL bindings" proposal in mind. Eventually, there won't be any JavaScript shims between Rust-generated wasm functions and native DOM methods. Because the wasm functions are statically type checked, some of those native methods' dynamic type checks should become unnecessary, promising to unlock even-faster-than-JavaScript DOM access.

Guide

📚 Read the wasm-bindgen guide here! 📚

You can find general documentation about using Rust and WebAssembly together here.

API Docs

License

This project is licensed under either of

at your option.

Contribution

See the "Contributing" section of the guide for information on hacking on wasm-bindgen!

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].