| Crates.io | uy |
| lib.rs | uy |
| version | 0.1.2 |
| created_at | 2023-07-31 06:41:51.109689+00 |
| updated_at | 2023-07-31 06:53:51.360268+00 |
| description | A typesafe, flexible, simple, and user-friendly unit system library for Rust that has good error messages. |
| homepage | |
| repository | https://github.com/lachlansneff/uy |
| max_upload_size | |
| id | 930570 |
| size | 20,620 |
A typesafe, flexible, simple, and user-friendly unit system library for Rust that has good error messages.
uy not only stores the unit of a value in the typesystem, it also stores the scale within the unit's type itself.
For example, Quantity<f32, si::m> is not the same type as Quantity<f32, si::kilo<si::m>>.
To convert between types like that, call the .convert() method on Quantity.
use uy::{Quantity, si};
fn how_long(
d: Quantity<f32, si::m>,
v: Quantity<f32, uy::Div<si::m, si::s>>
) -> Quantity<f32, si::s> {
d / v
}