Skip to content

Releases: Siderust/qtty

v0.8.5

01 Jun 15:50
4073c35

Choose a tag to compare

What's Changed

  • Update version to 0.8.5 and enhance README with badges by @VPRamon in #56

Full Changelog: v0.8.4...v0.8.5

v0.8.4

28 May 19:03
c926a7f

Choose a tag to compare

What's Changed

  • feat: add support for u32 scalar type and re-export quantity types by @VPRamon in #55

Full Changelog: v0.8.3...v0.8.4

v0.8.0

14 May 07:50
71adda9

Choose a tag to compare

What's Changed

  • feat(ci): add GitHub Actions workflow for publishing to crates.io by @VPRamon in #46
  • Add typed unit aliases, constants, and integration tolerances by @VPRamon in #47
  • chore: update changelog for version 0.8.0 release by @VPRamon in #48
  • fix: remove version specification for qtty-core and qtty-derive depen… by @VPRamon in #49
  • chore: update version to 0.8.0 across all relevant files by @VPRamon in #50
  • fix: update FFI version to 0.8.0 in tests and dependencies by @VPRamon in #51

Full Changelog: v0.7.1...v0.8.0

v0.7.1

08 May 21:34

Choose a tag to compare

What's Changed

  • Add dimensionless units and enhance astronomical unit definitions by @VPRamon in #45

Full Changelog: v0.7.0...v0.7.1

v0.7.0

04 May 15:13

Choose a tag to compare

[0.7.0] - 2026-05-04

Added

  • Expanded the built-in unit inventory:

    • frequency feature with hertz units from millihertz through terahertz.
    • chemistry feature with mole units from nanomole through kilomole.
    • electrical feature with current, charge, voltage, resistance, capacitance,
      inductance, magnetic-flux, and magnetic-flux-density units.
    • density feature with SI density units and customary PoundPerCubicFoot.
    • Additional energy units: Picojoule, Nanojoule, WattHour,
      KilowattHour, and customary BritishThermalUnit / Therm.
    • photometry linear SI units: Candela, Lumen, and Lux.
    • Rankine as a linear absolute temperature unit.
  • Added local tests for feature-gated length, time, mass, and angular submodules,
    including known-value conversions and proptest round-trips.

  • Pressure units in qtty-core::units::pressure (re-exported by qtty::pressure /
    qtty::unit). Always available: Pascal (canonical SI unit), Hectopascal (hPa,
    widely used in observatory site metadata), Millipascal, Kilopascal, Megapascal,
    Gigapascal, and Bar (= 10⁵ Pa). Bidirectional From conversions and
    cross-feature PartialEq / PartialOrd cover all pairs via pressure_units!.
    Named constants PASCAL, HECTOPASCAL, BAR, etc. for quick construction.
    New Pressure dimension alias added to qtty-core::dimension.

  • Temperature units in qtty-core::units::temperature (re-exported by
    qtty::temperature / qtty::unit). Always available: Kelvin (SI base unit, the
    only linear-scale thermodynamic temperature unit provided — affine-offset scales
    such as Celsius and Fahrenheit are intentionally omitted). Inventory macro
    temperature_units!, TemperatureUnit marker trait, KELVIN constant.
    New Temperature dimension alias added to qtty-core::dimension.

  • Photometry module (qtty-core::units::photometry, behind the photometry
    feature, re-exported by qtty::photometry). Uses a deliberate newtype design (not
    Quantity<U>) for logarithmic quantities where addition is not physically meaningful:

    • Magnitude — stellar magnitude scale (more negative = brighter).
    • SurfaceBrightness — magnitudes per square arcsecond.
    • flux_to_magnitude(flux, zero_point) / magnitude_to_flux(mag, zero_point)
      typed conversion helpers.
    • band_flux_to_surface_brightness(s10, zero_point) — converts S10 surface flux
      density to a SurfaceBrightness magnitude.
    • s10_to_surface_brightness(flux, zero_point) — typed variant accepting a typed
      S10s quantity and returning SurfaceBrightness; requires radiometry feature.
  • Angular wrap helpers on Quantity<U> for any U: AngularUnit:

    • wrap_to_signed_pi() — folds any angle into (−π, +π] (i.e. (−180°, +180°]).
    • wrap_to_unsigned_pi() — folds any angle into [0, 2π) (i.e. [0°, 360°)).
    • fold_to_pi() — folds any angle into [0, π] (i.e. [0°, 180°]), useful for
      unsigned angular separations.
  • Typed square root (UnitSqrt trait, qtty-core):

    • UnitSqrt — implemented automatically for Prod<U, U> (a unit multiplied by
      itself, i.e. a squared unit).
    • Quantity<Prod<U, U>, S>::sqrt() — returns Quantity<U, S> with the correct
      halved dimension; the result type is inferred from the input unit, so no
      annotation is needed at the call site.
    • Re-exported from qtty as qtty::UnitSqrt.
  • Radiometry additions (extending the initial radiometry feature):

    • PhotonPerSquareCentimeterNanosecondSteradian (ph·cm⁻²·ns⁻¹·sr⁻¹) photon
      radiance unit, matching the NSB/darknsb pipeline output convention.
    • spectral_radiance_to_photon_radiance_ns_nm(energy_radiance, lambda) — converts
      SI spectral energy radiance (W·m⁻²·sr⁻¹·nm⁻¹) to spectral photon radiance
      in the NSB/SkyCalc optical convention (ph·cm⁻²·ns⁻¹·sr⁻¹·nm⁻¹) using the
      exact 1 / (h · c) constant.
  • Solid-angle units in qtty-core::units::solid_angle (re-exported by
    qtty::solid_angle / qtty::unit). Always available: SquareDegree
    (canonical), Steradian, SquareMilliradian. Behind astro:
    SquareArcminute, SquareArcsecond. Bidirectional From conversions and
    cross-feature PartialEq / PartialOrd cover all pairs. New
    SolidAngle = Dim<…, A=P2> dimension alias added to qtty-core::dimension.

  • radiometry feature (qtty-core, forwarded by qtty, implies
    fundamental-physics) introducing qtty_core::units::radiometry with:

    • Radiance / SpectralRadiance / PhotonRadiance /
      SpectralPhotonRadiance / InverseSolidAngle dimension aliases.
    • SI and CGS unit markers: WattPerSquareMeterSteradian,
      ErgPerSecondSquareCentimeterSteradian, the per-metre / per-nanometre /
      per-ångström spectral-radiance markers, and the ph·… / ph·cm⁻²·s⁻¹·sr⁻¹,
      ph·cm⁻²·ns⁻¹·sr⁻¹, ph·cm⁻²·s⁻¹·sr⁻¹·Å⁻¹, ph·cm⁻²·s⁻¹·sr⁻¹·nm⁻¹
      photon-radiance markers.
    • S10 ("10th-magnitude stars per square degree") on InverseSolidAngle,
      matching the Leinert et al. zodiacal-light tables.
    • erg_to_photon(spectral_energy_radiance, lambda) typed helper using the
      exact 1 / (h · c) constant ≈ 5.034 × 10⁷ ph / (erg · Å).

Changed

  • qtty-ffi full linear unit coverage — the stable FFI registry now
    exports every linear unit family exposed by qtty's all-units feature,
    including pressure, solid angle, temperature, radiometry, photometric SI
    units, frequency, chemistry, electrical, and density. Existing discriminants
    remain stable; new dimensions were appended with explicit DimensionId
    values 11 through 32 and new 11xxxx32xxxx discriminant ranges.

  • qtty-ffi energy inventory parity — added the missing Picojoule,
    Nanojoule, WattHour, KilowattHour, BritishThermalUnit, and Therm
    FFI unit IDs so the ABI now matches the Rust energy module exactly.

  • qtty-ffi release line — ABI version now reports 700
    (qtty_ffi_version() == 700) for the 0.7.0 release.

  • Breaking: corrected public SI aliases so pressure::MPa now means
    Megapascal instead of Millipascal; use MilliPa for millipascal. Also
    added the expected force::MN alias for Meganewton.

  • radiometry module now follows the standard qtty unit-module architecture:

    • Per-dimension marker traits (RadianceUnit, SpectralRadianceUnit,
      PhotonRadianceUnit, SpectralPhotonRadianceUnit, InverseSolidAngleUnit).
    • Per-dimension inventory macros (radiance_units!, spectral_radiance_units!,
      photon_radiance_units!, spectral_photon_radiance_units!,
      inverse_solid_angle_units!) with bidirectional From conversions and
      cross-unit-ops PartialEq / PartialOrd within each dimension group.
    • All 13 unit markers registered as BuiltinUnit and covered by
      assert_units_are_builtin compile-time drift checks.
    • Unit markers re-exported from qtty::unit (e.g. qtty::unit::S10,
      qtty::unit::WattPerSquareMeterSteradian); quantity aliases generated at the
      qtty crate root (e.g. qtty::S10s, qtty::WattsPerSquareMeterSteradian)
      when the radiometry feature is enabled.

v0.6..1 - 25/04/2026

25 Apr 20:24

Choose a tag to compare

[0.6.1] - 2026-04-25

Fixed

  • qtty-ffi packaged builds no longer depend on sibling workspace paths during
    build.rs; cargo package/cargo publish now verify cleanly from the
    packaged crate source.

  • Updated crate docs, README dependency snippets, and the FFI version helper to
    the 0.6.1 release line (qtty_ffi_version() == 601).

[0.6.0] - 2026-04-25

Added

  • Quantity-level real-number rounding helpers (qtty-core, re-exported by
    qtty) — Quantity<U, S> for S: Real now exposes floor(), ceil(),
    round(), trunc(), and fract(), matching the scalar Real surface while
    preserving unit types through common rounding workflows.

  • assert_units_are_builtin! (qtty-core, #[doc(hidden)]) — compile-time
    assertion macro driven by each dimension's inventory macro under #[cfg(test)].
    Uses a supertrait bound pattern: adding a unit to a dimension inventory without
    also registering it in register_builtin_units! becomes a compile error. Catches
    the most common drift case (new unit added to the dimension file but the
    cross-dimension registry not updated).

  • Facade consistency test (qtty/tests/inventory_consistency.rs) — compile-time
    integration test that uses exported inventory macros to assert every always-available
    unit in angular, length, time, mass, power, area, and volume
    is both re-exported in qtty::unit::* and has a root quantity alias in qtty::*.
    Adding a unit to an inventory but forgetting the corresponding lib.rs re-export
    or root alias generation now fails CI instead of silently becoming a missing export.

  • New public acceleration / force / energy unit families across qtty-core
    and qtty, including Accel<L, T>, MeterPerSecondSquared,
    StandardGravity, SI newton/joule ladders, and feature-gated
    PoundForce, Dyne, Calorie, and electron-volt units.

  • SquareOf<L> / CubeOf<L> helper aliases — new typed composition helpers
    for area and volume quantities derived from multiplied length quantities.

  • New stable unit arithmetic layer (unit_arithmetic module) with UnitDiv and UnitMul extension traits that control output types for quantity division and multiplication, replacing the previous blanket impls.

  • Generic recovery impls: U / U → Unitless, N / Per<N, D> → D, Per<N, D> * D → N, D * Per<N, D> → N.

  • Macro-generated fallback pair tables for all built-in unit marker types: cross-unit division produces Per<A, B>, multiplication produces Prod<A, B>.

  • Exported macros impl_unit_division_pairs!, impl_unit_multiplication_pairs!, and impl_unit_arithmetic_pairs! for downstream custom units to opt into the same generated arithmetic.

  • asin, acos, and atan methods on Quantity<Unitless, S> (moved from Quantity<Per<U, U>>) so same-unit ratios keep ergonomic trig behavior.

  • Comprehensive compile-time and runtime tests for unit arithmetic covering all recovery patterns, cross-unit pairs, and custom-unit registration.

  • Added invalid-unit regression coverage for qtty-ffi quantity carriers so raw u32 unit IDs from C callers are rejected cleanly instead of producing undefined behavior.

  • Added serde round-trip coverage for the Rust-side qtty-ffi carrier structs using their raw numeric unit IDs.

  • qtty-ffi Area & Volume FFI coverageDimensionId::Area (6) and DimensionId::Volume (7) are now part of the ABI, exposing 11 area units (SquareMeterSquareDecimeter) and 13 volume units (CubicMeterUsTeaspoon) with stable discriminant ranges 60000–60010 and 70000–70012 respectively.

  • qtty-ffi discriminants.csv — new file that is the sole source of ABI-stable discriminant values. All unit metadata (ratios, symbols) is now derived at compile time from <Type as qtty::Unit>::RATIO/::SYMBOL, eliminating the historic dual-source-of-truth between units.csv and qtty-core.

  • qtty crate-root module re-exportsqtty::{area, volume, acceleration, force, energy} are now re-exported at the crate root, and root quantity aliases are generated from the inventory macros for all built-in scalar families.

  • Auto-generated FFI unit constantsqtty-ffi now emits named QTTY_UNIT_*
    constants from discriminants.csv for the full registry instead of maintaining
    a hand-written subset.

  • AngularRate<N, D> type alias and AngularRateUnit trait as the primary
    names for angular-rate quantities (Angular / Time), replacing the
    misleading Frequency / FrequencyUnit names. The dimension alias is now
    AngularRate.

  • Exact::checked_from_f64(value: f64) -> Option<Self> for converting a
    floating-point value to an exact scalar without silent overflow; returns
    None when the value is out of range or non-representable. (QTTY-003)

  • Quantity::checked_to_lossy<T>() -> Option<Quantity<T, S>> for safe
    cross-unit conversion when the scalar type is Exact; returns None
    instead of silently saturating.

  • 18 regression tests in qtty-core/tests/audit_regressions.rs covering
    cross-unit comparison symmetry, integer abs() boundary behaviour, and
    lossy/checked conversion semantics.

  • MulAssign<S> for Quantity<U, S> — in-place scalar multiplication
    (q *= 2.0), symmetric with the pre-existing DivAssign<S>.

  • Rem<Quantity<U, S>> for same-unit remainder — 5 m % 3 m == 2 m,
    complementing the pre-existing scalar Rem<S>.

  • DAYS_PER_GREGORIAN_YEAR named constant (qtty-core::time) — replaces
    the four repeated 365.242_5 literals in Year/Decade/Century/Millennium
    ratio expressions.

Removed

  • qtty-ffi units.csv — hardcoded ratio/symbol data removed; metadata is now derived from qtty-core trait constants so divergence is impossible at compile time.
  • qtty-ffi deprecated helper functionsmeters_into_ffi, try_into_meters, kilometers_into_ffi, try_into_kilometers, seconds_into_ffi, try_into_seconds, minutes_into_ffi, try_into_minutes, hours_into_ffi, try_into_hours, days_into_ffi, try_into_days, radians_into_ffi, try_into_radians, degrees_into_ffi, try_into_degrees have been removed. Use From/TryFrom directly (qty.into(), qty.try_into()).
  • Removed the scalar-decimal feature and rust_decimal scalar support from qtty-core and the qtty facade crate.
  • Breaking: Removed the public Simplify trait and .simplify() method from qtty-core and the qtty facade crate; unit arithmetic now resolves these cases at compile time.
  • Breaking: Removed the deprecated frequency alias modules from qtty-core and qtty. Use angular_rate for Angular / Time quantities.
  • Breaking: Removed deprecated Quantity<Unitless>::asin(), acos(), and atan() scalar-returning methods. Use asin_angle(), acos_angle(), and atan_angle() instead.

Changed

  • Downstream crates can now keep more rounding and timestamp-normalization logic
    in typed quantities instead of erasing units to raw floating-point values for
    floor/ceil/round/fractional extraction.

  • CODATA 2018 → 2022 (fundamental-physics) — Updated Bohr radius,
    classical electron radius, and electron reduced Compton wavelength to the
    CODATA 2022 recommended values. Planck length and atomic mass unit are
    unchanged (identical in both adjustments). Affected constants and their
    tests updated accordingly.

  • Internal: inventory macros are now the canonical unit lists — every
    always-available unit family in qtty-core (angular, length, time,
    mass, power, area, volume, acceleration, force, energy) and the
    relevant feature-gated subfamilies now expose a {family}_units!($cb:path)
    macro that drives conversions, cross-unit ops, facade alias generation,
    FFI registry generation, and builtin-unit checks. No public API change.

  • Internal: nominal length units have full pairwise From conversions
    length_nominal_units! now drives impl_unit_from_conversions! for all 8 nominal
    units (SolarRadius, SolarDiameter, EarthRadius, EarthEquatorialRadius,
    EarthPolarRadius, JupiterRadius, LunarRadius, LunarDistance). Previously
    only SolarRadius ↔ Kilometer was generated. The explicit cross-group pair is
    retained.

  • Breaking: Metric area marker types SquareMeter, SquareKilometer,
    SquareCentimeter, and SquareMillimeter are now Prod<Length, Length>
    aliases. side * side can therefore be assigned directly to SquareMeters,
    but symbol behavior now follows Prod (Display renders m·m; there is no
    dedicated SquareMeter::SYMBOL value like ).

  • Breaking: Same-unit division (Meter / Meter) now directly returns Quantity<Unitless> instead of Quantity<Per<Meter, Meter>>. Code that type-annotated the result as Quantity<Per<U, U>> must be updated.

  • qtty-ffi build pipelinebuild.rs now resolves all unit metadata by extracting inventory types from qtty-core source files and emitting <Type as qtty::Unit>::RATIO / ::SYMBOL expressions directly. Hardcoded floats are gone; the generated registry is always in sync with qtty-core by construction.

  • qtty-ffi consistency testtests/csv_inventory_consistency.rs replaced by tests/consistency.rs. The new test uses only compile-time UnitId::$variant assertions (forward check) and a lightweight runtime smoke-test that verifies trait-derived metadata matches the registry. The KNOWN_RATIO_DIVERGENCES / KNOWN_SYMBOL_DIVERGENCES workaround lists are gone.

  • Breaking: Per<N, D> * D and D * Per<N, D> now directly return the numerator quantity (e.g., Quantity<Meter>) instead of Quantity<Prod<Per<N, D>, D>>. The .to() call to recover the numerator is no longer needed.

  • Breaking: N / Per<N, D> now directly returns the denominator quantity (e.g., `Quantity<S...

Read more

v0.5.0 - 2026/03/31

08 Apr 21:59

Choose a tag to compare

What's Changed

  • Update dependencies and documentation across the qtty workspace by @VPRamon in #21

Full Changelog: v0.4.0...v0.5.0

[0.5.0] - 2026-03-31

Removed

  • Removed the string-based qtty-ffi JSON serialization entry points:
    • qtty_quantity_to_json_value / qtty_quantity_from_json_value
    • qtty_quantity_to_json / qtty_quantity_from_json
    • qtty_derived_to_json / qtty_derived_from_json
    • qtty_string_free

Changed

  • qtty-ffi now exposes a POD-only FFI surface for quantity carriers; callers should pass qtty_quantity_t and qtty_derived_quantity_t directly instead of string payloads.

v0.4.0 - 2026/02/26

08 Apr 21:57

Choose a tag to compare

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.

v0.3.1 - 2026/02/24

08 Apr 21:56

Choose a tag to compare

What's Changed

Full Changelog: v0.3.0...v0.3.1

[0.3.1] - 2026-02-24

Added

  • New qtty crate feature alloc for heap-backed helpers in no_std builds. (see #10)
  • Integration compile checks for qtty::qtty_vec! across std, no_std + alloc, and pure no_std modes. (see #10)
  • New integer scalar facade modules qtty::i8, qtty::i16, and qtty::i128, mirroring the unit aliases available in qtty::i32. (see #11)
  • New cross-unit-ops feature in qtty-core and qtty (enabled by default) to gate generation of direct cross-unit comparison operator impls (==, <, etc.). (see #15)
  • New reduced-mode CI profile (No Cross-Unit Ops) plus targeted compile checks validating eq_unit/cmp_unit and ensuring direct cross-unit operators are disabled when the feature is off. (see #15)
  • Documented compile-time benchmark commands (cargo +nightly -Z timings) for comparing default and reduced-mode builds. (see #15)
  • FFI JSON serialization: New FFI functions for serializing and deserializing QttyQuantity/QttyDerivedQuantity to/from JSON:
    • qtty_quantity_to_json_value / qtty_quantity_from_json_value
    • qtty_quantity_to_json / qtty_quantity_from_json
    • qtty_derived_to_json / qtty_derived_from_json

v0.3.0 - 2026-02-09

09 Feb 21:17

Choose a tag to compare

Added

  • Added support for operations with Rust built-in numeric types, improving ergonomics when combining Quantity values with primitive scalars.
  • Added Iterator::sum support for Quantity, including ergonomic accumulation into f64 from iterators of Quantity<_, f64> (owned or borrowed items).
  • Full dimensional arithmetic support using compile-time exponent math (Dim, DimMul, DimDiv) powered by typenum.
  • New product unit type Prod<A, B> to represent unit multiplication (Length * Length, Area * Length, etc.).
  • New area unit module with metric, land, and imperial/US units (for example SquareMeter, Hectare, Acre).
  • New volume unit module with metric cubic units, liter-family units, and imperial/US units (for example CubicMeter, Liter, UsGallon).
  • New qtty example dimensional_arithmetic demonstrating compile-time dimensional composition and conversions.
  • Quantity::eq_unit and Quantity::cmp_unit helpers for comparing values across different units in the same dimension.
  • Cross-unit comparison operator support (==, !=, <, >, <=, >=) via impl_unit_conversions!, with unit conversion applied before comparison.
  • Expanded qtty-core comparison tests covering same-unit ordering, scalar ordering, cross-unit comparisons, NaN behavior, and integer Eq/Ord use cases.
  • Quantity::mean helper to compute the arithmetic midpoint between two values of the same quantity type (including integer scalar support).
  • New exported qtty::qtty_vec! macro for building typed quantity arrays and Vecs directly from scalar literals.

Changed

  • Division and multiplication now compose dimensions generically at the type level, so multiplied quantities produce Quantity<Prod<...>> and can be converted to named units with .to().
  • Core/base dimensions are now unified under the new generic Dim<...> model, with backward-compatible aliases for DivDim and new MulDim.
  • Public exports now include area/volume modules and additional dimension aliases from qtty-core and the qtty facade.
  • Quantity ordering/equality trait implementations were refined: PartialOrd is now implemented explicitly (same-unit and scalar comparisons), and Eq/Ord are enabled when the scalar type supports total equality/ordering.
  • Unit display symbols were standardized to canonical scientific notation across affected units (for example Degree now renders as °, Radian as rad, and SI symbols like km/μm are used consistently).