mirror of
https://github.com/qwjyh/xdbm
synced 2024-11-21 22:30:12 +09:00
update byte formatting
This commit is contained in:
parent
46ffab3425
commit
f43b508819
2 changed files with 4 additions and 5 deletions
|
@ -94,7 +94,7 @@ impl fmt::Display for OnlineStorage {
|
|||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"O {name:<10} {size:<10} {provider:<10}",
|
||||
"O {name:<10} {size:<10.2} {provider:<10}",
|
||||
name = self.name(),
|
||||
size = Byte::from_u64(self.capacity).get_appropriate_unit(UnitType::Binary),
|
||||
provider = self.provider,
|
||||
|
|
|
@ -146,7 +146,7 @@ impl fmt::Display for PhysicalDrivePartition {
|
|||
let removable_indicator = if self.is_removable { "+" } else { "-" };
|
||||
write!(
|
||||
f,
|
||||
"P {name:<10} {size:<10} {removable:<1} {kind:<6} {fs:<5}",
|
||||
"P {name:<10} {size:<10.2} {removable:<1} {kind:<6} {fs:<5}",
|
||||
name = self.name(),
|
||||
size = Byte::from_u64(self.capacity).get_appropriate_unit(UnitType::Binary),
|
||||
removable = removable_indicator,
|
||||
|
@ -184,10 +184,9 @@ fn select_sysinfo_disk(disks: &sysinfo::Disks) -> Result<&Disk> {
|
|||
let kind = format!("{:?}", disk.kind());
|
||||
let mount_path = disk.mount_point();
|
||||
let total_space = byte_unit::Byte::from_u64(disk.total_space())
|
||||
.get_appropriate_unit(UnitType::Binary)
|
||||
.to_string();
|
||||
.get_appropriate_unit(UnitType::Binary);
|
||||
format!(
|
||||
"{}: {} {} ({}, {}) {}",
|
||||
"{}: {} {:>+5.1} ({}, {}) {}",
|
||||
i,
|
||||
name,
|
||||
total_space,
|
||||
|
|
Loading…
Reference in a new issue