1 unstable release

0.1.0 Feb 24, 2024

#952 in WebAssembly

Download history 10/week @ 2024-07-19 18/week @ 2024-07-26 2/week @ 2024-08-02 109/week @ 2024-08-09 1/week @ 2024-08-16 10/week @ 2024-09-06 29/week @ 2024-09-13 59/week @ 2024-09-20 49/week @ 2024-09-27 22/week @ 2024-10-04 12/week @ 2024-10-11 14/week @ 2024-10-18 31/week @ 2024-10-25 15/week @ 2024-11-01

73 downloads per month

MIT/Apache

11KB
156 lines

WebAssembly, Automatically Abstracted Away

This crate is a collection of small helpers, designed to help writing crates that work on both the web platform and native.

It does not contain any implementation code, and only delegates to production-ready implementations.

Its main value is abstracting away the different implementation types, so that you do not have to care about whether your code is running on the web or on native.

In particular, it has a whole set of Send- and Sync-related traits. These traits are the thread-safe variant for native, and on the web they will fallback to the non-thread-safe variant. This is because JsValues are not thread-safe, and wasm-bindgen-futures's executor is thread-local anyway, so there is much less need for thread-safety.

This being said, this crate is opinionated. What it offers may not necessarily match what you need. If you think of a missing feature that could be abstracted away between web and native applications please open a PR, but eg. if you need a thread-safe future on the web then you should just use Send.

This crate is very much work-in-progress. While everything implemented should be working fine (because there is basically no code at all, it only redirects to well-known implementations), there are certainly lots of features that are not implemented yet. Pull requests are welcome!

Dependencies

~4–14MB
~166K SLoC