| Crates.io | binmod-mdk-core |
| lib.rs | binmod-mdk-core |
| version | 0.1.3 |
| created_at | 2025-05-20 05:20:38.159597+00 |
| updated_at | 2025-06-09 02:10:03.924636+00 |
| description | Binmod PDK for Rust |
| homepage | |
| repository | https://gitlab.com/binmod/binmod-mdk-rs |
| max_upload_size | |
| id | 1680804 |
| size | 9,545 |
Rust binmod module development kit (MDK).
cargo add binmod-mdk
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))
}
Finally, compile your module to the wasm32-wasip1 target:
rustup target add wasm32-wasip1
cargo build --target wasm32-wasip1 --release
This project is licensed under MIT License.
If you encounter any issues or have feedback, please open an issue.
Made with ❤️ by Tim Pogue