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