Crates.io | wird |
lib.rs | wird |
version | 0.1.0 |
source | src |
created_at | 2022-04-10 19:39:24.856686 |
updated_at | 2022-04-10 19:39:24.856686 |
description | Write Javascript with inlined Rust that will later become Wasm |
homepage | |
repository | https://github.com/XToripuru/wird |
max_upload_size | |
id | 565210 |
size | 28,308 |
Wird allows to write Javascript with inlined Rust that will later become Wasm
You can inline Rust using #{...};
syntax, inside these you can define functions, structs, etc.
Expressions are also allowed by annotating the return type #{...} -> T;
, they can capture Js variables by annotating which variables are captured along with their type #[a: A, b: B]{...} -> T;
NOTE: in order to export function to Js you have to add #[wasm]
to it and make it pub
Check out examples
After writing code you can compile it using wird
:
wird expand index.js
You can also quickly host your files with wird host
cargo
and then you can get the following via cargo install
wasm-pack
http-server
cargo install wird
This is still very incomplete, and shouldn't be used in production yet