12 releases (6 breaking)
| new 0.8.1 | May 14, 2026 |
|---|---|
| 0.6.1 | Apr 25, 2026 |
| 0.5.0 | Mar 31, 2026 |
| 0.2.1 | Dec 22, 2025 |
#426 in FFI
160 downloads per month
Used in 2 crates
(via tempoch-ffi)
175KB
2.5K
SLoC
qtty-ffi
C-compatible ABI bridge for qtty.
qtty-ffi exposes stable carrier structs, unit identifiers, status codes, and
conversion/formatting functions so C and C++ consumers can use qtty's unit
registry without reimplementing conversion logic.
Highlights
QttyQuantityandQttyDerivedQuantityPOD carriers- stable
UnitIdandDimensionIddiscriminants extern "C"entry points for construction, conversion, inspection, and formatting- generated header at
include/qtty_ffi.h - optional Rust-side
qtty_serdeandpyo3helpers
Install
[dependencies]
qtty-ffi = "0.8.0"
C example
#include "qtty_ffi.h"
qtty_quantity_t meters;
qtty_quantity_make(1000.0, UNIT_ID_METER, &meters);
qtty_quantity_t kilometers;
if (qtty_quantity_convert(meters, UNIT_ID_KILOMETER, &kilometers) == QTTY_OK) {
/* kilometers.value == 1.0 */
}
Rust example
use qtty::Meter;
use qtty_ffi::{QttyQuantity, UnitId};
let qty: QttyQuantity = Meter::new(12.5).into();
assert_eq!(qty.unit, UnitId::Meter as u32);
Related crates
qtty: user-facing Rust facadeqtty-core: low-level unit type systemqtty-derive: proc-macro for custom unit markers
Dependencies
~1.7–4.5MB
~91K SLoC