wasmy, easily customize my wasm app

Overview

wasmy WasmGroup-QQ42726807

wasmy, easily customize my wasm app!

features

  • Completely shield vm-wasm interaction details
  • Simple and flexible ABI, supports freely adding vm and wasm handlers using attribute macros (#[vm_handle(0)] /#[wasm_handle(0)])
  • Provide attribute macro #[wasm_onload] support to initialize wasm
  • Support multi-threaded concurrency
  • Provides context, layering friendly
  • Features a security sandbox
  • Use protobuf as the interaction protocol
  • Support custom import objects

crates

[dependencies]
wasmy-vm = "0.5"
[dependencies]
wasmy-abi = "0.5"
wasmy-macros = "0.5"

example

  • wasm code (target = "wasm32-wasi")
use rand::random;
use wasmy_abi::*;
use wasmy_abi::test::*;

#[wasm_handle(0)]
fn multiply(ctx: WasmCtx, args: TestArgs) -> Result
    {
    
   let rid 
   = 
   random
   ::<
   u8>() 
   as 
   i32;
    
   println!(
   "[Wasm-Simple({})] handle wasm method({}) ctx={:?}, args={{{:?}}}", rid, 
   0, ctx, args);

    
   let 
   mut vm_args 
   = TestArgs
   ::
   new();
    vm_args.a 
   = rid;
    vm_args.b 
   = rid;
    
   let vm_rets: TestRets 
   = ctx.
   call_vm(
   0, vm_args)?;
    
   println!(
   "[Wasm-Simple({})] call vm method({}): args={{{:?}}}, rets={}", rid, 
   0, vm_rets, vm_rets.
   get_c());

    
   let 
   mut rets 
   = TestRets
   ::
   new();
    rets.
   set_c(args.a 
   * args.b);
    
   Ok(rets)
}
  
  • vm code
Result { let mut rets = TestRets::new(); rets.set_c(args.a + args.b); Ok(rets) } // more #[vm_handle(i32)] fn ... }">
use wasmy_vm::*;
use crate::test::{TestArgs, TestRets};

...

fn main() {
    link_mod();
    println!("wasmy, easily customize my wasm app!");
    ...
    let wasm_caller = load_wasm(wasm_path).unwrap();
    let mut data = TestArgs::new();
    data.set_a(2);
    data.set_b(5);
    for i in 1..=3 {
        let res: TestRets = wasm_caller.call(0, data.clone()).unwrap();
        println!("NO.{}: {}+{}={}", i, data.get_a(), data.get_b(), res.get_c())
    }
}

// Make sure the mod is linked
fn link_mod() {
    #[vm_handle(0)]
    fn add(args: TestArgs) -> Result
     {
        
    let 
    mut rets 
    = TestRets
    ::
    new();
        rets.
    set_c(args.a 
    + args.b);
        
    Ok(rets)
    }
    
    // more #[vm_handle(i32)] fn ...
}
   

test simple example

  • raw cargo cmd:
$ rustup target add wasm32-wasi

$ cargo +nightly build --target=wasm32-wasi --example=simple
$ cargo +nightly run --example=svm -- ../../wasm32-wasi/debug/examples/simple.wasm
  • alias cargo cmd:
$ rustup target add wasm32-wasi

$ cargo +nightly wasm simple
$ cargo +nightly svm simple
You might also like...
Macro to customize the behavior of `?`

::custom-try Macro to customize the behavior of ? Examples use ::custom_try::custom_try; #[repr(transparent)] pub struct FfiResult { pub status_c

Customize window border colors :3
Customize window border colors :3

cute-borders Makes focused and unfocused window borders have a different border color, configurable per program. Windows 11 only. Preview Installing D

A low-ish level tool for easily writing and hosting WASM based plugins.

A low-ish level tool for easily writing and hosting WASM based plugins. The goal of wasm_plugin is to make communicating across the host-plugin bounda

Create WASM plugins easily in Rust.

Scotch Library for creating WASM plugins with Rust. Scotch allows you to pass complex types to/from functions in WASM plugins. It achieves that by enc

fas stand for Find all stuff and it's a go app that simplify the find command and allow you to easily search everything you nedd
fas stand for Find all stuff and it's a go app that simplify the find command and allow you to easily search everything you nedd

fas fas stands for Find all stuff and it's a rust app that simplify the find command and allow you to easily search everything you need. Note: current

zigfi is an open-source stocks, commodities and cryptocurrencies price monitoring CLI app, written fully in Rust, where you can organize assets you're watching easily into watchlists for easy access on your terminal.
zigfi is an open-source stocks, commodities and cryptocurrencies price monitoring CLI app, written fully in Rust, where you can organize assets you're watching easily into watchlists for easy access on your terminal.

zigfi zigfi is an open-source stocks, commodities and cryptocurrencies price monitoring CLI app, written fully in Rust, where you can organize assets

Easily sync your clipboard between devices. This is a work in progress app.

Clipboard Sync Description Easily sync your clipboard between devices. This is a work in progress app. Stack Frontend: React Tauri isomorphic-ws TSX,

WASM runtime for Deku and Michelson-to-WASM compiler

Tuna This repository has two different projects, a plugable VM for running WASM contracts on Deku and a Michelson to WASM compiler which also has some

Distribute a wasm SPA as HTML by wrapping it as a polyglot "html+wasm+zip"

A packer that adds a webpage to WASM module, making it self-hosted! Motivation At the moment, Browsers can not execute WebAssembly as a native single

A Wasm component optimizer (mostly a wrapper around wasm-opt)

component-opt An optimizer for Wasm Components Current Status This project currently only offers one optimization and does not allow it to be configur

Wasm video filter booth app written in Rust
Wasm video filter booth app written in Rust

Video effect booth written in Rust and WebAssembly Play with it here: https://mtharrison.github.io/wasmbooth/ Aim I wrote this purely to teach myself

Dister builds and bundles your wasm web app.

dister Dister builds and bundles your wasm web app. Installation cargo install dister Requirements wasm32-unknown-unknown target: rustup target add wa

An API and test-app that exposes zcash functionality for app consumption

Zingolib This repo provides both a library for zingoproxyclient and zingo-mobile, as well as an included cli application to interact with zcashd via l

A todo list app that indexes your app to find TODO:'s

forgot A todo list app that indexes your app to find TODO:'s Usage to list all your todos forgot list list all your todos ignoring search in ./target,

Rust library to create a Good Game Easily

ggez What is this? ggez is a Rust library to create a Good Game Easily. The current version is 0.6.0-rc0. This is a RELEASE CANDIDATE version, which m

⏮ ⏯ ⏭ A Rust library to easily read forwards, backwards or randomly through the lines of huge files.

EasyReader The main goal of this library is to allow long navigations through the lines of large files, freely moving forwards and backwards or gettin

Easily embed and manage assets for your web application to build standalone-executables. Offers filename hashing, templating and more.

reinda: easily embed and manage assets This library helps you manage your assets (external files) and is mostly intended to be used in web application

Easily share data between terminal windows!
Easily share data between terminal windows!

abra A tool that makes data sharing between terminal windows easy. abra can be used for displaying info about the current working directory, for split

A (self hosted) pastebin for easily sharing text right from the terminal

termpad termpad allows you to easily host a pastebin server for saving and viewing text right from the terminal, or the browser. Client Usage Assuming

Releases(v0.5.6)
Owner
henrylee2cn
Cease to programing and cease to live.
henrylee2cn
Dister builds and bundles your wasm web app.

dister Dister builds and bundles your wasm web app. Installation cargo install dister Requirements wasm32-unknown-unknown target: rustup target add wa

Mohammed Alyousef 1 Apr 9, 2022
Autogenerated async RPC bindings that instantly connect a JS frontend to a Rust backend service via WebSockets and WASM.

Turbocharger Autogenerated async RPC bindings that instantly connect a JS frontend to a Rust backend service via WebSockets and WASM. See https://gith

null 28 Jan 2, 2023
Wasm runtime written in Rust

Wasm runtime written in Rust

Teppei Fukuda 1 Oct 29, 2021
The Wasm-Enabled, Elfin Allocator

wee_alloc The Wasm-Enabled, Elfin Allocator API Docs | Contributing | Chat Built with ?? ?? by The Rust and WebAssembly Working Group About wee_alloc:

Rust and WebAssembly 567 Dec 28, 2022
A template for kick starting a Rust and WebAssembly project using wasm-pack.

A template for kick starting a Rust and WebAssembly project using wasm-pack.

Haoxi Tan 1 Feb 14, 2022
{Wasm+Rust} Build and animate Conway's Game of Life

A self-guided learning project that includes Rust + Wasm together. Who knows, maybe Typescript and React joins too..

M.Yavuz Yagis 1 Feb 14, 2022
Example app & project structure for Golem Cloud

Synopsis This project serves as an example/template for building an application using WebAssembly Component Model (and in this case, an app for Ziverg

Terry L 5 Aug 4, 2023
The Heros NFT Marketplace Boilerplate project is designed to let users fork, customize, and deploy their own nft marketplace app to a custom domain, ultra fast.

Heros NFT on Solana The Heros NFT Marketplace Boilerplate project is designed to let users fork, customize, and deploy their own nft marketplace app t

nightfury 6 Jun 6, 2022
The sysroot manager that lets you build and customize `std`

PSA: Xargo is in maintenance mode xargo The sysroot manager that lets you build and customize std Cross compiling `std` for i686-unknown-linux-gnu Xar

Jorge Aparicio 993 Jan 2, 2023
VSCode extension to quickly write and customize well tested Solana snippets.

Solana Snippets The Solana Snippets VSCode Extension allows you to quickly insert Solana snippets into your code. This snippets are well tested in a r

patriciobcs 7 Dec 15, 2022