Skip to content

compose-us-research/deno-rust-wasm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

deno-rust-wasm

Test project for Rust and deno interop via WebAssembly.

Run it by building the WebAssembly module and use deno to import / test it:

wasm-pack build && deno main.ts

The problem

Returning a JsValue or a successful result Ok(JsValue) yields a pointer instead of the JsValue?

See returns_js_value_directly and returns_ok_js_value for the Rust implementations and the deno usage.

Strangely, using Err(JsValue) works as you can see in returns_err_js_value and its usage in deno

Another try

wasm-pack build --target web

When initializing through the .js file, the browser stuff seems to work. Deno is still not really happy with it for now.

Working

. start-deno.sh

This changes the default wasm-pack build result to provide an init function. The init function expects a WebAssembly.Module which you get by importing the _bg.wasm file from wasm-pack build.

About

Test project for Rust and deno interop via WebAssembly

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published