Struct humansize::SizeFormatter
source · pub struct SizeFormatter<T: ToF64 + Unsigned, O: AsRef<FormatSizeOptions>> { /* private fields */ }
Implementations§
source§impl<V: ToF64 + Unsigned, O: AsRef<FormatSizeOptions>> SizeFormatter<V, O>
impl<V: ToF64 + Unsigned, O: AsRef<FormatSizeOptions>> SizeFormatter<V, O>
sourcepub fn new(value: V, options: O) -> Self
pub fn new(value: V, options: O) -> Self
Examples found in repository?
examples/sizes.rs (line 14)
5 6 7 8 9 10 11 12 13 14 15 16
fn main() {
println!("{}", format_size(5456usize, BINARY));
println!("{}", format_size(1024usize, DECIMAL));
println!("{}", format_size(1000usize, WINDOWS));
println!("{}", format_size(1_023_654_123_654_u64, BINARY));
println!("{}", format_size(123456789usize, DECIMAL));
println!("{}", format_size_i(-123456789, WINDOWS));
println!("{}", SizeFormatter::new(1234u32, BINARY));
println!("{}", ISizeFormatter::new(1234, BINARY));
}
Trait Implementations§
source§impl<T: ToF64 + Unsigned + Copy, O: AsRef<FormatSizeOptions> + Copy> Display for SizeFormatter<T, O>
impl<T: ToF64 + Unsigned + Copy, O: AsRef<FormatSizeOptions> + Copy> Display for SizeFormatter<T, O>
source§impl<'a, U: ToF64 + Unsigned + Copy, O: AsRef<FormatSizeOptions>> From<&'a SizeFormatter<U, O>> for ISizeFormatter<U, &'a O>
impl<'a, U: ToF64 + Unsigned + Copy, O: AsRef<FormatSizeOptions>> From<&'a SizeFormatter<U, O>> for ISizeFormatter<U, &'a O>
source§fn from(source: &'a SizeFormatter<U, O>) -> Self
fn from(source: &'a SizeFormatter<U, O>) -> Self
Converts to this type from the input type.