v0.4.0 - 2026/02/26
What's Changed
Full Changelog: v0.3.1...v0.4.0
[0.4.0] - 2026-02-26
Added
- Implemented
Display,LowerExp, andUpperExpdelegation forQuantity<U, S>so standard Rust format annotations (precision, scientific notation) are respected by all unit types. - Exposed a new FFI function
qtty_quantity_format(qtty_quantity_t, precision, flags, buf, buf_len)plus format flag constantsQTTY_FMT_DEFAULT,QTTY_FMT_LOWER_EXP, andQTTY_FMT_UPPER_EXPfor C consumers to format quantities from Rust with the same options as Rust's formatters. - Added C++ convenience:
qtty::Quantity<UnitTag>::format(int precision, uint32_t flags)that calls the FFI formatter, and a C++20std::formatterspecialization to integrate withstd::formatwhen available. - Added comprehensive C++ tests covering streaming
operator<<,format(), and scientific/precision formatting modes.
Changed
- cbindgen/header generation:
qtty-ffibuild now gracefully skips automatic cbindgen expansion on stable toolchains (nightly required for macro expansion); the shippedqtty_ffi.his updated to include the new formatter API and constants.
Fixed
- Corrected
Displayimplementations to delegate formatting to the inner scalar so{:.N},{:e}, and related annotations behave as expected forQuantityvalues. - Adjusted C++ helpers and tests to match C++ stream precision semantics and to ensure
format()mirrors specified precision/flags.