| Crates.io | mikrozen |
| lib.rs | mikrozen |
| version | 0.0.1 |
| created_at | 2025-05-25 08:27:22.164665+00 |
| updated_at | 2025-05-25 08:27:22.164665+00 |
| description | A minimal, ergonomic router and JSON response macro for #![no_std] WASI Rust plugins |
| homepage | |
| repository | https://github.com/hlop3z/mikrozen |
| max_upload_size | |
| id | 1688182 |
| size | 46,956 |
A minimal, ergonomic router and JSON response macro for #![no_std] WASI Rust plugins.
#![no_std] + extern crate allocresponse! macro for JSON outputdecimal feature for rust_decimaluse mikrozen::prelude::*;
fn hello(args: Input) -> Output {
let name = args.get_str("name");
response! {
"message" => format!("Hello, {}", name),
"success" => true,
}
}
router! {
"hello" => hello,
}
// Usage:
// let input = RouterInput::new(BTreeMap::new());
// let out = Router::dispatch("hello", input);
let n = args.get_i64("n");
let flag = args.get_bool("flag");
let arr = args.get_array("arr");
let obj = args.get_object("obj");
let val = args.get_value("key");
Enable with --features decimal to use get_decimal:
let dec = args.get_decimal("amount");
BSD 3-Clause