ct_ratio 1.2.0

Compile-time rational arithmetic for use in generics
Documentation
  • Coverage
  • 96%
    24 out of 25 items documented0 out of 10 items with examples
  • Size
  • Source code size: 14.3 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 494.9 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 8s Average build duration of successful builds.
  • all releases: 8s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • ChrysoliteAzalea/ct_ratio
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ChrysoliteAzalea

Compile-time rational arithmetic in Rust

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.