nowasm 0.0.2

No-std, no-unsafe and no-dependencies WebAssembly 1.0 runtime library
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// $ cargo build --target wasm32-unknown-unknown --example hello
#[cfg(target_arch = "wasm32")]
extern "C" {
    fn print(s: *const u8, len: i32);
}

#[cfg(target_arch = "wasm32")]
#[no_mangle]
pub fn hello() {
    let msg = "Hello, World!\n";
    unsafe {
        print(msg.as_ptr(), msg.len() as i32);
    }
}