#formatting #numbers #comma #depend #std #compile #fmtint

anzahlmenschen

A number formatting crate that only depends on std

1 unstable release

0.1.0 Sep 18, 2022

#304 in Value formatting

MPL-2.0 license

8KB
51 lines

Anzahl-Menschen (Number-People) is a number formatting library that aims to make your compile times low at all costs so that you don’t need to compile the beast that is serde just so that you can put commas in numbers.

It just works, no need for frills and fancy stuff.

Why did you reinvent the wheel?

I was looking for a number formatting library for a game I'm working on and saw num_format but unfortunately I looked at its 14 dependencies and decided that it was inefficient.

I prefer my compile times low so I made my own one.


lib.rs:

Anzahl-Menschen (Number-People) is a number formatting library that aims to make your compile times low at all costs so that you don't need to compile the beast that is serde just so that you can put commas in numbers.

use anzahlmenschen::fmtint;

fn main() {
    let x = 1234567890;
    println!("{}", fmtint(x)); // 1,234,567,890
}

It just works, no need for frills and fancy stuff.

I'm French! Include a function for me?

I've done my work!

use anzahlmenschen::fmtint;

fn main() {
    let x = 1234567890;
    println!("{}", fmtint(x).replace(",", " ")); // 1 234 567 890
}

No runtime deps