#byte #pretty #display #format

repr-size

Ergonomic functions to display a count of bytes to an end user

3 releases

0.1.2 May 19, 2022
0.1.1 May 18, 2022
0.1.0 May 18, 2022

#36 in #bytes

MIT/Apache

9KB
118 lines

repr-bytes

Small, simple library to convert byte amounts to pretty, human readable sizes.

Quickstart

let my_file_size = Size::from(54222);

println!("{}", my_file_size); // "54.2 KB"
println!("{}", my_file_size.to_si_string()); // "53.0 KiB"
println!("{}", my_file_size.repr(Units::Bytes)); // "54222 B"

Features

serde - enables serialization/deserialization of Size <-> usize


lib.rs:

Small, simple library to convert byte amounts to pretty, human readable sizes.

Quickstart

let my_file_size = Size::from(54222);

println!("{}", my_file_size); // "54.2 kB"
println!("{}", my_file_size.to_si_string()); // "53.0 KiB"
println!("{}", my_file_size.repr(Units::Bytes)); // "54222 B"

Features

serde - enables serialization/deserialization of Size <-> usize

Dependencies

~170KB