Crates.io | wasmedge-bindgen-macro |
lib.rs | wasmedge-bindgen-macro |
version | 0.4.1 |
source | src |
created_at | 2021-12-21 08:23:52.467464 |
updated_at | 2022-11-18 03:35:10.176944 |
description | Pass string, vec and primitive types from host to webassembly |
homepage | |
repository | https://github.com/second-state/wasmedge-bindgen |
max_upload_size | |
id | 501069 |
size | 21,863 |
This crate only export a macro named #[wasmedge_bindgen] that used for retouching exporting functions to make it support more data types.
You can set the parameters to any one of the following types:
You can set the return values to any one of the following types:
The only way to tell the host that the error has occurred is to return Err<String> of Result.
#[wasmedge_bindgen]
pub fn create_line(p1: String, p2: String, desc: String) -> String
#[wasmedge_bindgen]
pub fn lowest_common_multiple(a: i32, b: i32) -> i32
#[wasmedge_bindgen]
pub fn sha3_digest(v: Vec<u8>) -> Vec<u8>
#[wasmedge_bindgen]
pub fn info(v: Vec<u8>) -> Result<(u8, String), String>