mirror of
https://github.com/LeopoldArkham/humansize
synced 2024-11-10 06:14:15 +00:00
Impl ToF64 for f32 and f64
This commit is contained in:
parent
09628d8492
commit
759ac54577
2 changed files with 5 additions and 1 deletions
|
@ -12,7 +12,7 @@ macro_rules! impl_to_f64 {
|
|||
)*)
|
||||
}
|
||||
|
||||
impl_to_f64!(for usize u8 u16 u32 u64 isize i8 i16 i32 i64);
|
||||
impl_to_f64!(for usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64);
|
||||
|
||||
pub trait Unsigned {}
|
||||
|
||||
|
|
|
@ -13,6 +13,10 @@ fn test_sizes() {
|
|||
assert_eq!(format_size(1024u32, BINARY), "1 KiB");
|
||||
assert_eq!(format_size(1024u32, WINDOWS), "1 kB");
|
||||
|
||||
assert_eq!(format_size_i(1000f32, DECIMAL), "1 kB");
|
||||
assert_eq!(format_size_i(1000f64, DECIMAL), "1 kB");
|
||||
|
||||
|
||||
let custom_options = FormatSizeOptions::from(DECIMAL).space_after_value(false);
|
||||
assert_eq!(format_size(1000u32, custom_options), "1kB");
|
||||
|
||||
|
|
Loading…
Reference in a new issue