qtty
StableUnits and physical quantities for Rust, with dimensional checks at compile time.
4 stars
0 forks
Rust
BSD-3-Clause
Updated 1 weeks ago
Why it exists
qtty keeps units explicit in code, so conversions and arithmetic stay readable and harder to misuse. It is used across the Siderust crates, but it is useful on its own too.
Key Features
- Compile-time dimensional analysis
- Zero-cost abstractions
- SI and astronomical units
- No-std compatible
Getting Started
# Add to your Cargo.toml
[dependencies]
qtty = "0.8.5"
# Use physical quantities
use qtty::{AU, KM, DAY};
let distance = 1.523 * AU; // Mars semi-major axis
let period = 686.97 * DAY;
let speed = distance / period; // Compiler validates dimensions Contributing
We welcome contributions! Here's how you can help:
- 1 Fork the repository and create your branch from main
- 2 Make your changes and add tests if applicable
- 3 Ensure all tests pass with cargo test
- 4 Submit a pull request with a clear description
License
This project is licensed under the BSD-3-Clause license. See the LICENSE file for details.
Quick Links
Tags
units physics dimensional-analysis astronomy rust