wvwasi

Crates.iowvwasi
lib.rswvwasi
version0.2.0
sourcesrc
created_at2023-07-04 04:19:49.42732
updated_at2024-03-17 13:23:04.512965
descriptionA WebView with WASI may be the best JS/WASM runtime, and wvwasi is it.
homepagehttps://wvwasi.com
repositoryhttps://github.com/defims/wvwasi
max_upload_size
id907633
size283,497
Wei Long (defims)

documentation

README

wvwasi

A WebView with WebAssembly System Interface (WASI) may be the best Javascript/WebAssembly runtime, and wvwasi is it.

                              |
Javascript/WebAssembly code   |  Javascript/WebAssembly application code
                              |                 |
                              |                 v
                              | WASI syscalls (inserted by compiler toolchain)
                              |                 |
------------------------------+                 |
                              |                 v
Javascript/WebAssembly runtime|    wvwasi (implementation WASI in webview)
(WebView)                     |                 |
                              |                 v
                              |        platform-specific calls
                              |

(Hence wvwasi isn't for making programs execute on WASI runtimes. That would either be a wasm32-wasi target complied by rust, or done through POSIX emulation by the Emscripten or wasi-sdk toolchains.)

WARNING: This is a alpha. Work in progress.

Example Usage

Currently only the Windows platform is implemented, other platforms are on the way.

cargo run --example hello_world --target x86_64-pc-windows-msvc

How does it achieve high performance?

No magic, just IPC and sharedbuffer.

Why not implement WASI using Web APIs?

  1. Webkit oppose File System Access API.
  2. Unable to preopen system folder.
  3. You can not customize your own interface with high-performance communication mechanisms.
  4. You can use native system capabilities, such as sockets at the transport layer, without being limited to websockets at the application layer.

API

The WASI API is versioned. This documentation is based on the WASI preview 1 snapshot. wvwasi implements the WASI system call API with the following additions/modifications:

System Calls

This section has been adapted from the official WASI API documentation.

Commit count: 9

cargo fmt