binmod-mdk-macros

Crates.iobinmod-mdk-macros
lib.rsbinmod-mdk-macros
version0.1.3
created_at2025-05-20 05:20:32.770627+00
updated_at2025-06-09 02:09:59.582419+00
descriptionBinmod PDK for Rust
homepage
repositoryhttps://gitlab.com/binmod/binmod-mdk-rs
max_upload_size
id1680803
size14,748
Timothy Pogue (wizrds)

documentation

README

Binmod MDK Rust

Rust binmod module development kit (MDK).

Quick Start

Installation

cargo add binmod-mdk

Basic Usage

use binmod_mdk::{mod_fn, host_imports, FnResult};

#[host_imports(namespace = "test")]
unsafe extern "host" {
    fn host_log(message: String);
    fn host_add(a: u32, b: u32) -> u32;
}

// NOTE: Function parameters and return types must be serializable. All module functions
// should return a `FnResult<T>` where `T` is the return type.
#[mod_fn(name = "greet")]
fn greet_impl(name: String, number: u32) -> FnResult<String> {
    unsafe { host_log(format!("Hello, {}! Your number is: {}", name, number))? };
    Ok(format!("Hello, {}! Your number is: {}", name, number))
}

Compiling

Finally, compile your module to the wasm32-wasip1 target:

rustup target add wasm32-wasip1
cargo build --target wasm32-wasip1 --release

License

This project is licensed under MIT License.

Support & Feedback

If you encounter any issues or have feedback, please open an issue.

Made with ❤️ by Tim Pogue

Commit count: 0

cargo fmt