mikrozen

Crates.iomikrozen
lib.rsmikrozen
version0.0.1
created_at2025-05-25 08:27:22.164665+00
updated_at2025-05-25 08:27:22.164665+00
descriptionA minimal, ergonomic router and JSON response macro for #![no_std] WASI Rust plugins
homepage
repositoryhttps://github.com/hlop3z/mikrozen
max_upload_size
id1688182
size46,956
(hlop3z)

documentation

https://docs.rs/mikrozen

README

Mikrozen

A minimal, ergonomic router and JSON response macro for #![no_std] WASI Rust plugins.

Features

  • #![no_std] + extern crate alloc
  • Simple string-based routing for WASI plugins
  • Ergonomic response! macro for JSON output
  • Input extraction helpers for common types
  • Optional decimal feature for rust_decimal
  • Designed for Go-hosted WASI, not browsers

Example Usage

use 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);

Input Extraction

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");

Decimal Feature

Enable with --features decimal to use get_decimal:

let dec = args.get_decimal("amount");

License

BSD 3-Clause

Commit count: 4

cargo fmt