| Crates.io | qtty |
| lib.rs | qtty |
| version | 0.2.2 |
| created_at | 2025-12-12 20:20:03.453996+00 |
| updated_at | 2026-01-13 21:09:55.516308+00 |
| description | Strongly typed physical and astronomical quantities. |
| homepage | |
| repository | https://github.com/Siderust/qtty |
| max_upload_size | |
| id | 1982069 |
| size | 65,315 |
qttyThe user-facing crate that re-exports the qtty-core type system plus a curated set of astronomy-friendly units.
Quantity<U> to prevent mixing incompatible dimensions.to::<TargetUnit>() with zero runtime overhead.velocity, frequency, …) and astronomy staples (AU, light-year, solar mass/luminosity).no_std environments (uses libm) and has optional serde support.Every unit module from qtty-core is re-exported at the crate root for convenience:
Degrees, Radian, arcseconds, wrapping helpers)Seconds, Minutes, Days, sidereal/astronomical variations)Meters, Kilometers, AstronomicalUnit, LightYear, …)Kilograms, SolarMass)Watts, SolarLuminosity)Per<Length, Time>, Per<Angular, Time> aliases)unitless helpers for scalar quantities[dependencies]
qtty = "0.1.0"
Disable default features for no_std:
[dependencies]
qtty = { version = "0.1.0", default-features = false }
use qtty::{Degrees, Radian};
let a = Degrees::new(90.0);
let r = a.to::<Radian>();
assert!((r.value() - core::f64::consts::FRAC_PI_2).abs() < 1e-12);
use qtty::{Kilometer, Kilometers, Second, Seconds};
use qtty::velocity::Velocity;
let d = Kilometers::new(1_000.0);
let t = Seconds::new(100.0);
let v: Velocity<Kilometer, Second> = d / t;
assert!((v.value() - 10.0).abs() < 1e-12);
std (default): enables std support in qtty-core.serde: serializes/deserializes Quantity<U> as bare f64 values (unit is encoded by the type).pyo3: enables PyO3 conversions so Quantity<U> types convert to/from Python float and can be used
directly as #[pyclass] fields (requires building with --features pyo3 for qtty-core).qtty-core: the minimal zero-cost type system used underneath this facade.qtty-ffi: exposes the same quantities and conversions over a stable C ABI.AGPL-3.0 (see ../LICENSE).