Crate size_fmt

Source
Expand description

§size_fmt

CICD Crates.io Docs.rs License

This library formats sizes in a human readable format.


The API and Implementation is inspired by dtolnay/itoa.


§Features

§Example

fn main() {
    let mut buffer = size_fmt::Buffer::new();
    let printed = buffer.human_fmt(4096);

    assert_eq!(printed, "4.0K")
}

Structs§

Buffer
A correctly sized stack allocated array of bytes for the formatted size to be written into.

Traits§

Integer
An integer that can be written into a [size_fmt::Buffer].