Debian Codegraph @

examples/custom_options.rs

raw symbols SCIP
1 extern crate humansizerust-analyzer cargo humansize 2.1.3 humansize/;
2 use humansizerust-analyzer cargo humansize 2.1.3 crate/::{format_size, FormatSizeOptionsrust-analyzer cargo humansize 2.1.3 options/FormatSizeOptions#, DECIMALrust-analyzer cargo humansize 2.1.3 options/defaults/DECIMAL.};
3
4 fn mainrust-analyzer cargo humansize 2.1.3 main().() {
5 // Create a new FormatSizeOptions struct starting from one of the defaults
6 let custom_options = FormatSizeOptionsrust-analyzer cargo humansize 2.1.3 options/FormatSizeOptions#::fromrust-analyzer cargo humansize 2.1.3 options/impl#[FormatSizeOptions]from().(DECIMALrust-analyzer cargo humansize 2.1.3 options/defaults/DECIMAL.).decimal_placesrust-analyzer cargo humansize 2.1.3 options/impl#[FormatSizeOptions]decimal_places().(5);
7
8 // Then use it
9 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{}", format_size(3024usize, custom_options));
10 }