| Crates.io | joto_format |
| lib.rs | joto_format |
| version | 0.1.0 |
| created_at | 2026-01-21 02:47:06.578783+00 |
| updated_at | 2026-01-21 02:47:06.578783+00 |
| description | Fast, const-safe formatter for SI, US Customary, and typesetting dimensions with exactness tracking. |
| homepage | |
| repository | https://github.com/xorgy/joto |
| max_upload_size | |
| id | 2058109 |
| size | 109,703 |
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.
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);
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);
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.
Triple licensed, at your option:
ISC license (LICENSE-ISC)
Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
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.