| Crates.io | ct_ratio |
| lib.rs | ct_ratio |
| version | 1.2.0 |
| created_at | 2025-04-06 18:38:59.435645+00 |
| updated_at | 2025-04-06 19:04:21.199424+00 |
| description | Compile-time rational arithmetic for use in generics |
| homepage | |
| repository | https://github.com/ChrysoliteAzalea/ct_ratio |
| max_upload_size | |
| id | 1623274 |
| size | 14,284 |
The ct_ratio provides compile-time arithmetic in Rust using const functions and const generics. An example of such code:
type A = Ratio<1, 2>;
type B = Ratio<1, 3>;
type C = <RationalSum<A,B> as StaticArithmetic>::OpResult; // This type will be equal to Ratio<5, 6>
This code relies on a feature generic_const_exprs that is currently (at the README writing time) is considered incomplete. Please, use with caution.