Skip to content

v0.4.0 - 2026/02/26

Choose a tag to compare

@VPRamon VPRamon released this 08 Apr 21:57
· 113 commits to main since this release

What's Changed

  • Enhance quantity formatting in FFI: add support for precision and sci… by @VPRamon in #20

Full Changelog: v0.3.1...v0.4.0

[0.4.0] - 2026-02-26

Added

  • Implemented Display, LowerExp, and UpperExp delegation for Quantity<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 constants QTTY_FMT_DEFAULT, QTTY_FMT_LOWER_EXP, and QTTY_FMT_UPPER_EXP for 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++20 std::formatter specialization to integrate with std::format when available.
  • Added comprehensive C++ tests covering streaming operator<<, format(), and scientific/precision formatting modes.

Changed

  • cbindgen/header generation: qtty-ffi build now gracefully skips automatic cbindgen expansion on stable toolchains (nightly required for macro expansion); the shipped qtty_ffi.h is updated to include the new formatter API and constants.

Fixed

  • Corrected Display implementations to delegate formatting to the inner scalar so {:.N}, {:e}, and related annotations behave as expected for Quantity values.
  • Adjusted C++ helpers and tests to match C++ stream precision semantics and to ensure format() mirrors specified precision/flags.