tools/format: implement from u64 for HumanByte helper type

Could be problematic for systems where usize is 32 bit, but we do not
really support those.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2020-08-25 14:18:48 +02:00
parent 5a718dce17
commit c86b6f40d7

View File

@ -80,6 +80,11 @@ impl From<usize> for HumanByte {
HumanByte { b: v } HumanByte { b: v }
} }
} }
impl From<u64> for HumanByte {
fn from(v: u64) -> Self {
HumanByte { b: v as usize }
}
}
#[test] #[test]
fn correct_byte_convert() { fn correct_byte_convert() {