How to run WebAssembly from your Rust Program

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • CodiumAI - TestGPT | Generating meaningful tests for busy devs
  • SonarQube - Static code analysis for 29 languages.
  • InfluxDB - Access the most powerful time series database as a service
  • ONLYOFFICE ONLYOFFICE Docs — document collaboration in your environment
  • wasmtime

    A fast and secure runtime for WebAssembly

    //Original Code from https://github.com/bytecodealliance/wasmtime/blob/main/examples/hello.rs //Adapted for brevity use anyhow::Result; use wasmtime::*; fn main() -> Result<()> { println!("Compiling module..."); let engine = Engine::default(); let module = Module::from_file(&engine, "hello.wat")?; //(1) println!("Initializing..."); let mut store = Store::new( &engine, () ); //(2) println!("Creating callback..."); let hello_func = Func::wrap(&mut store, |_caller: Caller<'_, ()>| { println!("Calling back..."); }); //(3) println!("Instantiating module..."); let imports = [hello_func.into()]; let instance = Instance::new(&mut store, &module, &imports)?; println!("Extracting export..."); let run = instance.get_typed_func::<(), ()>(&mut store, "run")?; //(4) println!("Calling export..."); run.call(&mut store, ())?; //(5) println!("Done."); Ok(()) }

  • CouchDB

    Seamless multi-master syncing database with an intuitive HTTP/JSON API, designed for reliability

    Apache CouchDB belongs to the family of NoSQL databases. It is a document store with a strong focus on replication and reliability. One of the most significant differences between CouchDB and a relational database (besides the absence of tables and schemas) is how you query data. Relational databases allow their users to execute arbitrary and dynamic queries via SQL. Each SQL query may look completely different than the previous one. These dynamic aspects are significant for use cases where you work exploratively with your dataset but don't matter as much in a web context. Additionally, defining an index for a specific table is optional. Most developers will define indices to boost performance, but the database does not require it.

  • CodiumAI

    TestGPT | Generating meaningful tests for busy devs. Get non-trivial tests (and trivial, too!) suggested right inside your IDE, so you can code smart, create more value, and stay confident when you push.

  • rust-wasm-intro

    Example Code for Blogpost on "Embedding Wasm in your Rust application"

    Find the full source code on GitHub.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts