Skip to content

Rust Language

Rust Async Brief

As I tried to write a demo by rust wasm, I was thinking about what should be a better signature to export by rust for wasm. In the demo, I exported the process function as a promise:

pub async fn process(input: &[u8]) -> js_sys::Promise

This blog discusses my understanding of async concept in rust and discussion whether returning a promise is a good choice.

Rust Wasm Trail

Recently, I got interested in the WASM as it enables you to write code by rust but run it in the browser. At the first glance, I feel it greatly benefits the case that could be done in the client side, but due to the implementation, it still runs on the server side. It has two big benefits:

  • save server resources
  • implement in a strong type language with many powerful libraries and run it in the browser
  • more portable and convenient

This especially for small tool sites as it usually requires some computation resource, but not many. This blog records my experience to trail the rust wasm for my small tool. It's not a blog about what is wasm and the technical designs/implementations of rust wasm.