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
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • 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.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • 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