#sdk #wapc #webassembly #wasm #waxosuit

waxosuit-guest

Deprecated in factor of the wascc-actor crate

2 releases

✓ Uses Rust 2018 edition

0.3.6 Dec 4, 2019
0.3.5 Oct 7, 2019
0.3.3 Sep 25, 2019

#2 in #waxosuit

Download history 57/week @ 2020-01-11 37/week @ 2020-01-18 1/week @ 2020-01-25 7/week @ 2020-02-08 2/week @ 2020-02-15 23/week @ 2020-02-22 14/week @ 2020-02-29 14/week @ 2020-03-07 7/week @ 2020-03-14 21/week @ 2020-03-21 15/week @ 2020-03-28 23/week @ 2020-04-04 42/week @ 2020-04-11 1/week @ 2020-04-25

56 downloads per month

Apache-2.0

21KB
362 lines

Deprecated in favor of wascc-actor.


lib.rs:

waxosuit-guest

The waxosuit-guest library provides WebAssembly module developers with access to the Waxosuit host runtime. Each guest module has a single call handler, declared with the call_handler! macro. Inside this call handler, the guest module should check the operation of the delivered message and handle it accordingly, returning any binary payload in response. It is the responsibility of the guest module to ensure that the capability provider will be able to understand whichever messages it sends.

Example

extern crate waxosuit_guest as guest;

use guest::prelude::*;

call_handler!(handle_call);

pub fn handle_call(ctx: &CapabilitiesContext, operation: &str, msg: &[u8]) -> CallResult {
    match operation {
        http::OP_HANDLE_REQUEST => hello_world(ctx, msg),
        core::OP_HEALTH_REQUEST => Ok(vec![]),
        _ => Err("bad dispatch".into()),
    }     
}

fn hello_world(
   _ctx: &CapabilitiesContext,
   _msg: &[u8]) -> CallResult {
    Ok(vec![])
}

Dependencies

~2.6–4MB
~62K SLoC