All Projects → ewasm → ewasm-rust-api

ewasm / ewasm-rust-api

Licence: Apache-2.0 license
Ewasm API for Rust

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to ewasm-rust-api

wrc20-examples
This repository contains examples of WRC20 tokens written in different languages.
Stars: ✭ 12 (-87.76%)
Mutual labels:  ewasm
cap9
Capability-based security protocol for smart contracts
Stars: ✭ 22 (-77.55%)
Mutual labels:  ewasm

ewasm-rust-api

Build Version

This project aims to give a low-level and a high-level binding to ewasm from Rust.

Usage

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.

Author(s)

Alex Beregszaszi, Jake Lang

License

Apache 2.0

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].