[−][src]Crate wapc_guest
wapc-guest
The wapc-guest
library provides WebAssembly module developers with access to a
waPC-compliant host runtime. Each guest module registers
function handlers with register_function
. 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.
Example
extern crate wapc_guest as guest; use guest::prelude::*; #[no_mangle] pub extern "C" fn wapc_init() { register_function("sample:Guest!Hello", hello_world); } fn hello_world( _msg: &[u8]) -> CallResult { let _res = host_call("myBinding", "sample:Host", "Call", b"hello")?; Ok(vec![]) }
Modules
errors | Errors |
prelude | Glob imports for common guest module development |
Functions
__console_log⚠ | |
__guest_call | |
__guest_error⚠ | |
__guest_request⚠ | |
__guest_response⚠ | |
__host_call⚠ | |
__host_error⚠ | |
__host_error_len⚠ | |
__host_response⚠ | |
__host_response_len⚠ | |
console_log | |
host_call | The function through which all host calls take place. |
register_function |
Type Definitions
CallResult | |
HandlerResult |