1 | use alloc::string::String; |
---|---|
2 | |
3 | use crate::numeric_traits::*; |
4 | use crate::options::FormatSizeOptions; |
5 | use crate::ISizeFormatter; |
6 | |
7 | pub fn format_size_i(input: impl ToF64, options: impl AsRef<FormatSizeOptions>) -> String { |
8 | format!("{} ", ISizeFormatter::new(input, options)) |
9 | } |
10 | |
11 | pub fn format_size(input: impl ToF64 + Unsigned, options: impl AsRef<FormatSizeOptions>) -> String { |
12 | format_size_i(input, &options) |
13 | } |
14 | |
15 | pub fn make_format_i<T: ToF64>(options: impl AsRef<FormatSizeOptions>) -> impl Fn(T) -> String { |
16 | move |val: T| -> String { format_size_i(input:val, &options) } |
17 | } |
18 | |
19 | pub fn make_format<T: ToF64 + Unsigned>( |
20 | options: impl AsRef<FormatSizeOptions>, |
21 | ) -> impl Fn(T) -> String { |
22 | make_format_i(options) |
23 | } |
24 |