humansize/examples/custom_options.rs
LeopoldArkham d6d5b342b5 fmt
2022-09-12 21:44:22 +02:00

10 lines
333 B
Rust

extern crate humansize;
use humansize::{format_size, FormatSizeOptions, DECIMAL};
fn main() {
// Create a new FormatSizeOptions struct starting from one of the defaults
let custom_options = FormatSizeOptions::from(DECIMAL).decimal_places(5);
// Then use it
println!("{}", format_size(3024usize, custom_options));
}