Crates.io | ss_ewasm_api |
lib.rs | ss_ewasm_api |
version | 0.11.0 |
source | src |
created_at | 2021-06-17 05:33:16.397059 |
updated_at | 2021-06-17 05:33:16.397059 |
description | ewasm API for Rust |
homepage | |
repository | https://github.com/second-state/ewasm-rust-api |
max_upload_size | |
id | 411161 |
size | 47,427 |
A fork from ewasm/ewasm-rust-api
We open a PR to upstream to use the wasm_import_module
and remove the function prefix,
and it still pending not merge.
This modification will affect on using WasmEdge in SewUp, and block the release of SewUp.
So we fork and release it into crate.io.
This project aims to give a low-level and a high-level binding to ewasm from Rust.
Add the dependency, as usual:
[dependencies]
ewasm-api = "0.11"
Make sure the project is a library of cdylib
type:
[lib]
crate-type = ["cdylib"]
In your project, include the prelude:
use ewasm_api::prelude::*;
Additionally there is support for some macros to make creating contracts easier:
#[macro_use]
extern crate ewasm_api;
use ewasm_api::prelude::*;
fn entry() {
// The actual contract code goes here.
}
ewasm_entry_point!(entry);
Other modules are available as well, outside of the prelude. Refer to the documentation for more info.
ewasm-rust-api
builds with various feature sets:
default
: Builds with wee_alloc
as the global allocator and with the Rust standard library.qimalloc
: Builds with qimalloc as the global allocator.debug
: Exposes the debugging interface.experimental
: Exposes the experimental bignum system library API.To enable specific features include the dependency as follows:
[dependencies.ewasm_api]
version = "0.11"
default-features = false
features = ["std", "qimalloc"]
Further documentation is available here.
Alex Beregszaszi, Jake Lang
Apache 2.0