Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/XToripuru/wird
Write Javascript with inlined Rust that will later become Wasm
https://github.com/XToripuru/wird
Last synced: 6 days ago
JSON representation
Write Javascript with inlined Rust that will later become Wasm
- Host: GitHub
- URL: https://github.com/XToripuru/wird
- Owner: XToripuru
- Created: 2022-04-10T19:18:12.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-04-13T19:24:10.000Z (over 2 years ago)
- Last Synced: 2024-04-26T21:21:45.554Z (7 months ago)
- Language: Rust
- Size: 10.7 KB
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Wird
Wird allows to write Javascript with inlined Rust that will later become Wasm## Usage
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`
## Prerequisites
* `cargo` and then you can get the following via `cargo install`
* `wasm-pack`
* `http-server`## Download
`cargo install wird`## Work in progress
Although it compiles just fine there are still missing a lot of features, and it shouldn't be used in production yet