joto_format

Crates.iojoto_format
lib.rsjoto_format
version0.1.0
created_at2026-01-21 02:47:06.578783+00
updated_at2026-01-21 02:47:06.578783+00
descriptionFast, const-safe formatter for SI, US Customary, and typesetting dimensions with exactness tracking.
homepage
repositoryhttps://github.com/xorgy/joto
max_upload_size
id2058109
size109,703
Aaron Muir Hamilton (xorgy)

documentation

README

Joto Format

How do you write it down?

dependency status ISC/MIT/Apache 2.0 Build status Crates.io Docs

This package contains const-safe, allocation-free formatting of lengths, masses, and temperatures for working with other joto workspace packages.

In this workspace, IOTA is defined as one ninth of a nanometer, WHIT as 1⁄3200 µg, and SMIDGE as 1⁄90 mK. Formatting uses these integer base units and displays them as mixed-unit strings with exactness tracking.

Examples

Basic usage

use joto_constants::length::u64::MILLIMETER;
use joto_format::length::u64::format_dim;
use joto_format::length::{LengthFormat, Unit};

let o = format_dim(12345 * MILLIMETER, Unit::Meter, LengthFormat::new());
assert_eq!(o.as_str(), "12.345m");
assert!(o.exact);

Exactness

Formatting results include an exact field which indicates whether the value is exactly represented by the formatted string.

use joto_constants::mass::u64::MICROGRAM;
use joto_format::mass::u64::format_dim;
use joto_format::mass::{MassFormat, Unit};

let o = format_dim(MICROGRAM + MICROGRAM / 1000, Unit::Microgram, MassFormat::new());
assert_eq!(o.as_str(), "1µg");
assert!(!o.exact);

Minimum Supported Rust Version (MSRV)

This version of joto_format has been verified to compile with Rust 1.83 and later.

Future versions might increase the Rust version requirement. It will not be treated as a breaking change, and as such can even happen with small patch releases.

License

Triple licensed, at your option:

Contribution

Contributions are welcome by pull request or email. Please feel free to add your name to the AUTHORS file in any substantive pull request.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.

Commit count: 7

cargo fmt