JavaScript wrapper generation for rust code targeting wasm32-unknown-unknown.
This repository is currently very WIP, but there's a full working example Cargo project in examples/simple_summation/
.
General overview:
wasm-wrapper-gen
is composed of two interlocking parts:
- wasm-wrapper-gen
provides the js_fn!()
macro which generates extern "C"
functions
- wasm-wrapper-gen-build
is a build-script utility which scrapes the source for usages of js_fn!()
and generates a JavaScript file which binds to those exported functions.
Note: this assumes little-endian hardware (the majority of modern hardware).
bool
, u8
, u16
, u32
, usize
, i8
, i16
, i32
, isize
, f32
, f64
&[_]
, &mut [_]
, Vec<_>
where _
is any of the abovebool
, u8
, u16
, u32
, usize
, i8
, i16
, i32
, isize
, f32
, f64
Vec<_>
where _
is any of the aboveNext to do:
impl
blocks with self
arguments and creating wrapper JS types
which manage allocation sanely.Further future: