f64-fixed 0.2.1

Convert f64 to fixed-length string
Documentation
  • Coverage
  • 0%
    0 out of 4 items documented0 out of 3 items with examples
  • Size
  • Source code size: 7.09 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 248.03 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: 11s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • nanvel/f64-fixed
    0 0 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • nanvel

f64-fixed converts f64 to a fixed size String

Use cases:

  • Display arbitrary numbers on a device with limited number of indicators
  • Display a number in a fixed-font where alignment matters or space is limited

Usage

use f64_fixed::{to_fixed_string, ToFixedString};

assert_eq!(12345.0_f64.to_fixed_string(6), "12345 ");

assert_eq!(to_fixed_string(1., 6), "1     ");
assert_eq!(to_fixed_string(1., -6), "     1");

assert_eq!(to_fixed_string(12345., 6), "12345 ");
assert_eq!(to_fixed_string(123456., 6), "123456");
assert_eq!(to_fixed_string(1234567., 6), "1.23+6");