3 releases (stable)

1.1.0 Mar 6, 2022
1.0.0 Feb 1, 2022
0.1.0 Jan 2, 2022

#30 in #immutable-store

Download history 63/week @ 2023-07-14 97/week @ 2023-07-21 50/week @ 2023-07-28 61/week @ 2023-08-04 61/week @ 2023-08-11 39/week @ 2023-08-18 46/week @ 2023-08-25 53/week @ 2023-09-01 54/week @ 2023-09-08 64/week @ 2023-09-15 29/week @ 2023-09-22 48/week @ 2023-09-29 57/week @ 2023-10-06 56/week @ 2023-10-13 68/week @ 2023-10-20 86/week @ 2023-10-27

267 downloads per month
Used in 13 crates (via wasm-bus)

MIT/Apache

57KB
1K SLoC

WASM Bus Macros

Helpful macros that make it easier to export and import APIs.

Example API

Below is a simple example of how to emit the helper classes and serialization objects for a specific API

use wasm_bus::macros::*;

#[wasm_bus(format = "json")]
pub trait Time {
    async fn sleep(&self, duration_ms: u128);
}

Relative Objects

It is also possible to emit a series of sub-apis that carry with them some specific context

use serde::*;
use std::sync::Arc;
use wasm_bus::macros::*;

#[wasm_bus(format = "bincode")]
pub trait SocketBuilder {
    async fn connect(
        &self,
        url: String,
        state_change: impl Fn(SocketState),
        receive: impl Fn(Vec<u8>),
    ) -> Arc<dyn WebSocket>;
}

#[wasm_bus(format = "bincode")]
pub trait WebSocket {
    async fn send(&self, data: Vec<u8>) -> SendResult;
}

Testing

You can test your WASI program by uploading it to wapm.io and then heading over to the Tokera Shell

https://tokera.sh

Dependencies

~1.2–1.6MB
~38K SLoC