Releases: Siderust/qtty
v0.8.5
v0.8.4
v0.8.0
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
v0.7.0
[0.7.0] - 2026-05-04
Added
-
Expanded the built-in unit inventory:
frequencyfeature with hertz units from millihertz through terahertz.chemistryfeature with mole units from nanomole through kilomole.electricalfeature with current, charge, voltage, resistance, capacitance,
inductance, magnetic-flux, and magnetic-flux-density units.densityfeature with SI density units andcustomaryPoundPerCubicFoot.- Additional energy units:
Picojoule,Nanojoule,WattHour,
KilowattHour, andcustomaryBritishThermalUnit/Therm. photometrylinear SI units:Candela,Lumen, andLux.Rankineas 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 byqtty::pressure/
qtty::unit). Always available:Pascal(canonical SI unit),Hectopascal(hPa,
widely used in observatory site metadata),Millipascal,Kilopascal,Megapascal,
Gigapascal, andBar(= 10⁵ Pa). BidirectionalFromconversions and
cross-featurePartialEq/PartialOrdcover all pairs viapressure_units!.
Named constantsPASCAL,HECTOPASCAL,BAR, etc. for quick construction.
NewPressuredimension alias added toqtty-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!,TemperatureUnitmarker trait,KELVINconstant.
NewTemperaturedimension alias added toqtty-core::dimension. -
Photometry module (
qtty-core::units::photometry, behind thephotometry
feature, re-exported byqtty::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 aSurfaceBrightnessmagnitude.s10_to_surface_brightness(flux, zero_point)— typed variant accepting a typed
S10squantity and returningSurfaceBrightness; requiresradiometryfeature.
-
Angular wrap helpers on
Quantity<U>for anyU: 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 (
UnitSqrttrait,qtty-core):UnitSqrt— implemented automatically forProd<U, U>(a unit multiplied by
itself, i.e. a squared unit).Quantity<Prod<U, U>, S>::sqrt()— returnsQuantity<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
qttyasqtty::UnitSqrt.
-
Radiometry additions (extending the initial
radiometryfeature):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
exact1 / (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. Behindastro:
SquareArcminute,SquareArcsecond. BidirectionalFromconversions and
cross-featurePartialEq/PartialOrdcover all pairs. New
SolidAngle = Dim<…, A=P2>dimension alias added toqtty-core::dimension. -
radiometryfeature (qtty-core, forwarded byqtty, implies
fundamental-physics) introducingqtty_core::units::radiometrywith:Radiance/SpectralRadiance/PhotonRadiance/
SpectralPhotonRadiance/InverseSolidAngledimension aliases.- SI and CGS unit markers:
WattPerSquareMeterSteradian,
ErgPerSecondSquareCentimeterSteradian, the per-metre / per-nanometre /
per-ångström spectral-radiance markers, and theph·…/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") onInverseSolidAngle,
matching the Leinert et al. zodiacal-light tables.erg_to_photon(spectral_energy_radiance, lambda)typed helper using the
exact1 / (h · c)constant≈ 5.034 × 10⁷ ph / (erg · Å).
Changed
-
qtty-ffifull linear unit coverage — the stable FFI registry now
exports every linear unit family exposed byqtty'sall-unitsfeature,
including pressure, solid angle, temperature, radiometry, photometric SI
units, frequency, chemistry, electrical, and density. Existing discriminants
remain stable; new dimensions were appended with explicitDimensionId
values 11 through 32 and new11xxxx–32xxxxdiscriminant ranges. -
qtty-ffienergy inventory parity — added the missingPicojoule,
Nanojoule,WattHour,KilowattHour,BritishThermalUnit, andTherm
FFI unit IDs so the ABI now matches the Rustenergymodule exactly. -
qtty-ffirelease line — ABI version now reports700
(qtty_ffi_version() == 700) for the0.7.0release. -
Breaking: corrected public SI aliases so
pressure::MPanow means
Megapascalinstead ofMillipascal; useMilliPafor millipascal. Also
added the expectedforce::MNalias forMeganewton. -
radiometrymodule 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 bidirectionalFromconversions and
cross-unit-opsPartialEq/PartialOrdwithin each dimension group. - All 13 unit markers registered as
BuiltinUnitand covered by
assert_units_are_builtincompile-time drift checks. - Unit markers re-exported from
qtty::unit(e.g.qtty::unit::S10,
qtty::unit::WattPerSquareMeterSteradian); quantity aliases generated at the
qttycrate root (e.g.qtty::S10s,qtty::WattsPerSquareMeterSteradian)
when theradiometryfeature is enabled.
- Per-dimension marker traits (
v0.6..1 - 25/04/2026
[0.6.1] - 2026-04-25
Fixed
-
qtty-ffipackaged builds no longer depend on sibling workspace paths during
build.rs;cargo package/cargo publishnow verify cleanly from the
packaged crate source. -
Updated crate docs, README dependency snippets, and the FFI version helper to
the0.6.1release 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>forS: Realnow exposesfloor(),ceil(),
round(),trunc(), andfract(), matching the scalarRealsurface 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 inregister_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 inangular,length,time,mass,power,area, andvolume
is both re-exported inqtty::unit::*and has a root quantity alias inqtty::*.
Adding a unit to an inventory but forgetting the correspondinglib.rsre-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
andqtty, includingAccel<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_arithmeticmodule) withUnitDivandUnitMulextension 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 producesProd<A, B>. -
Exported macros
impl_unit_division_pairs!,impl_unit_multiplication_pairs!, andimpl_unit_arithmetic_pairs!for downstream custom units to opt into the same generated arithmetic. -
asin,acos, andatanmethods onQuantity<Unitless, S>(moved fromQuantity<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-ffiquantity carriers so rawu32unit IDs from C callers are rejected cleanly instead of producing undefined behavior. -
Added serde round-trip coverage for the Rust-side
qtty-fficarrier structs using their raw numeric unit IDs. -
qtty-ffiArea & Volume FFI coverage —DimensionId::Area(6) andDimensionId::Volume(7) are now part of the ABI, exposing 11 area units (SquareMeter…SquareDecimeter) and 13 volume units (CubicMeter…UsTeaspoon) with stable discriminant ranges 60000–60010 and 70000–70012 respectively. -
qtty-ffidiscriminants.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 betweenunits.csvand qtty-core. -
qttycrate-root module re-exports —qtty::{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 constants —
qtty-ffinow emits namedQTTY_UNIT_*
constants fromdiscriminants.csvfor the full registry instead of maintaining
a hand-written subset. -
AngularRate<N, D>type alias andAngularRateUnittrait as the primary
names for angular-rate quantities (Angular / Time), replacing the
misleadingFrequency/FrequencyUnitnames. 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
Nonewhen 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 isExact; returnsNone
instead of silently saturating. -
18 regression tests in
qtty-core/tests/audit_regressions.rscovering
cross-unit comparison symmetry, integerabs()boundary behaviour, and
lossy/checked conversion semantics. -
MulAssign<S>forQuantity<U, S>— in-place scalar multiplication
(q *= 2.0), symmetric with the pre-existingDivAssign<S>. -
Rem<Quantity<U, S>>for same-unit remainder —5 m % 3 m == 2 m,
complementing the pre-existing scalarRem<S>. -
DAYS_PER_GREGORIAN_YEARnamed constant (qtty-core::time) — replaces
the four repeated365.242_5literals inYear/Decade/Century/Millennium
ratio expressions.
Removed
qtty-ffiunits.csv— hardcoded ratio/symbol data removed; metadata is now derived from qtty-core trait constants so divergence is impossible at compile time.qtty-ffideprecated helper functions —meters_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_degreeshave been removed. UseFrom/TryFromdirectly (qty.into(),qty.try_into()).- Removed the
scalar-decimalfeature andrust_decimalscalar support fromqtty-coreand theqttyfacade crate. - Breaking: Removed the public
Simplifytrait and.simplify()method fromqtty-coreand theqttyfacade crate; unit arithmetic now resolves these cases at compile time. - Breaking: Removed the deprecated
frequencyalias modules fromqtty-coreandqtty. Useangular_rateforAngular / Timequantities. - Breaking: Removed deprecated
Quantity<Unitless>::asin(),acos(), andatan()scalar-returning methods. Useasin_angle(),acos_angle(), andatan_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 inqtty-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
Fromconversions —
length_nominal_units!now drivesimpl_unit_from_conversions!for all 8 nominal
units (SolarRadius,SolarDiameter,EarthRadius,EarthEquatorialRadius,
EarthPolarRadius,JupiterRadius,LunarRadius,LunarDistance). Previously
onlySolarRadius ↔ Kilometerwas generated. The explicit cross-group pair is
retained. -
Breaking: Metric area marker types
SquareMeter,SquareKilometer,
SquareCentimeter, andSquareMillimeterare nowProd<Length, Length>
aliases.side * sidecan therefore be assigned directly toSquareMeters,
but symbol behavior now followsProd(Displayrendersm·m; there is no
dedicatedSquareMeter::SYMBOLvalue likem²). -
Breaking: Same-unit division (
Meter / Meter) now directly returnsQuantity<Unitless>instead ofQuantity<Per<Meter, Meter>>. Code that type-annotated the result asQuantity<Per<U, U>>must be updated. -
qtty-ffibuild pipeline —build.rsnow resolves all unit metadata by extracting inventory types from qtty-core source files and emitting<Type as qtty::Unit>::RATIO/::SYMBOLexpressions directly. Hardcoded floats are gone; the generated registry is always in sync with qtty-core by construction. -
qtty-fficonsistency test —tests/csv_inventory_consistency.rsreplaced bytests/consistency.rs. The new test uses only compile-timeUnitId::$variantassertions (forward check) and a lightweight runtime smoke-test that verifies trait-derived metadata matches the registry. TheKNOWN_RATIO_DIVERGENCES/KNOWN_SYMBOL_DIVERGENCESworkaround lists are gone. -
Breaking:
Per<N, D> * DandD * Per<N, D>now directly return the numerator quantity (e.g.,Quantity<Meter>) instead ofQuantity<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...
v0.5.0 - 2026/03/31
What's Changed
Full Changelog: v0.4.0...v0.5.0
[0.5.0] - 2026-03-31
Removed
- Removed the string-based
qtty-ffiJSON serialization entry points:qtty_quantity_to_json_value/qtty_quantity_from_json_valueqtty_quantity_to_json/qtty_quantity_from_jsonqtty_derived_to_json/qtty_derived_from_jsonqtty_string_free
Changed
qtty-ffinow exposes a POD-only FFI surface for quantity carriers; callers should passqtty_quantity_tandqtty_derived_quantity_tdirectly instead of string payloads.
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.
v0.3.1 - 2026/02/24
What's Changed
- Fix issue #10 by @VPRamon in #11
- Fix issue #11 by @VPRamon in #12
- Fix issue #12 by @VPRamon in #13
- Fix issue #14 by @VPRamon in #16
- Fix issue 15 by @VPRamon in #17
- Add optional Rust type paths to unit definitions in units.csv by @VPRamon in #19
Full Changelog: v0.3.0...v0.3.1
[0.3.1] - 2026-02-24
Added
- New
qttycrate featureallocfor heap-backed helpers inno_stdbuilds. (see #10) - Integration compile checks for
qtty::qtty_vec!acrossstd,no_std + alloc, and pureno_stdmodes. (see #10) - New integer scalar facade modules
qtty::i8,qtty::i16, andqtty::i128, mirroring the unit aliases available inqtty::i32. (see #11) - New
cross-unit-opsfeature inqtty-coreandqtty(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 validatingeq_unit/cmp_unitand 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/QttyDerivedQuantityto/from JSON:qtty_quantity_to_json_value/qtty_quantity_from_json_valueqtty_quantity_to_json/qtty_quantity_from_jsonqtty_derived_to_json/qtty_derived_from_json
v0.3.0 - 2026-02-09
Added
- Added support for operations with Rust built-in numeric types, improving ergonomics when combining
Quantityvalues with primitive scalars. - Added
Iterator::sumsupport forQuantity, including ergonomic accumulation intof64from iterators ofQuantity<_, f64>(owned or borrowed items). - Full dimensional arithmetic support using compile-time exponent math (
Dim,DimMul,DimDiv) powered bytypenum. - New product unit type
Prod<A, B>to represent unit multiplication (Length * Length,Area * Length, etc.). - New
areaunit module with metric, land, and imperial/US units (for exampleSquareMeter,Hectare,Acre). - New
volumeunit module with metric cubic units, liter-family units, and imperial/US units (for exampleCubicMeter,Liter,UsGallon). - New
qttyexampledimensional_arithmeticdemonstrating compile-time dimensional composition and conversions. Quantity::eq_unitandQuantity::cmp_unithelpers for comparing values across different units in the same dimension.- Cross-unit comparison operator support (
==,!=,<,>,<=,>=) viaimpl_unit_conversions!, with unit conversion applied before comparison. - Expanded
qtty-corecomparison tests covering same-unit ordering, scalar ordering, cross-unit comparisons, NaN behavior, and integerEq/Orduse cases. Quantity::meanhelper 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 andVecs 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 forDivDimand newMulDim. - Public exports now include area/volume modules and additional dimension aliases from
qtty-coreand theqttyfacade. Quantityordering/equality trait implementations were refined:PartialOrdis now implemented explicitly (same-unit and scalar comparisons), andEq/Ordare enabled when the scalar type supports total equality/ordering.- Unit display symbols were standardized to canonical scientific notation across affected units (for example
Degreenow renders as°,Radianasrad, and SI symbols likekm/μmare used consistently).