mikrozen 0.0.1

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

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