Wardian docs

Unit converter

Try it

The app runs here in your browser. Nothing you type leaves it. Open it on its own.

Download unit-converter.wardian Import it in Wardian: Settings → Import.

A Wardian module app: 32 everyday conversions, each one a WebAssembly function of numbers. There is no page. Wardian reads the module's exports and draws a card for each function, with an input per parameter and a Run button.

Why a module: every conversion takes numbers and returns a number. That is exactly what a module app shows without help, so the whole interface comes from src/lib.rs. No HTML, no JavaScript.

FileWhat it is
src/lib.rsThe conversions. Each #[no_mangle] pub extern "C" fn becomes a card in Wardian. Unit tests at the end.
app.wasmThe module Wardian runs, about 2 KB. Built from src/lib.rs.
app.jsonThe title and the description in the app list.
build.shRebuilds app.wasm.
GroupFunctions
Temperaturec_to_f, f_to_c, c_to_k, k_to_c
Lengthkm_to_miles, miles_to_km, m_to_feet, feet_to_m, cm_to_inches, inches_to_cm, feet_inches_to_cm(feet, inches)
Masskg_to_lb, lb_to_kg, g_to_oz, oz_to_g
Volume (US)liters_to_gallons, gallons_to_liters, ml_to_floz, floz_to_ml
Speed and fuelkmh_to_mph, mph_to_kmh, mpg_to_l_per_100km, l_per_100km_to_mpg
Pressurekpa_to_psi, psi_to_kpa, bar_to_psi
Power and energykw_to_hp, hp_to_kw, kcal_to_kj, kj_to_kcal
Bodybmi_kg_m(weight_kg, height_m), bmi_lb_in(weight_lb, height_in)

How data moves: you type a number in a card and press Run (or Enter). Wardian calls the function with a JavaScript number, the module returns a 64-bit float, and Wardian shows it under the card. Nothing leaves the browser.

Names carry the units, because Wardian labels the inputs only "arg 1", "arg 2". So km_to_miles takes kilometres, and a function with two inputs names them in order: bmi_kg_m takes the weight in kilograms first, then the height in metres.

Limits:

Change it: edit src/lib.rs, run cargo test, run ./build.sh, then wardian check ..

This page is apps/unit-converter/README.md in the repository. Something wrong or missing? Change that file.