mirror of
https://github.com/qwjyh/xdbm
synced 2024-11-25 08:01:04 +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 {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
"O {name:<10} {size:<10} {provider:<10}",
|
"O {name:<10} {size:<10.2} {provider:<10}",
|
||||||
name = self.name(),
|
name = self.name(),
|
||||||
size = Byte::from_u64(self.capacity).get_appropriate_unit(UnitType::Binary),
|
size = Byte::from_u64(self.capacity).get_appropriate_unit(UnitType::Binary),
|
||||||
provider = self.provider,
|
provider = self.provider,
|
||||||
|
|
|
@ -146,7 +146,7 @@ impl fmt::Display for PhysicalDrivePartition {
|
||||||
let removable_indicator = if self.is_removable { "+" } else { "-" };
|
let removable_indicator = if self.is_removable { "+" } else { "-" };
|
||||||
write!(
|
write!(
|
||||||
f,
|
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(),
|
name = self.name(),
|
||||||
size = Byte::from_u64(self.capacity).get_appropriate_unit(UnitType::Binary),
|
size = Byte::from_u64(self.capacity).get_appropriate_unit(UnitType::Binary),
|
||||||
removable = removable_indicator,
|
removable = removable_indicator,
|
||||||
|
@ -184,10 +184,9 @@ fn select_sysinfo_disk(disks: &sysinfo::Disks) -> Result<&Disk> {
|
||||||
let kind = format!("{:?}", disk.kind());
|
let kind = format!("{:?}", disk.kind());
|
||||||
let mount_path = disk.mount_point();
|
let mount_path = disk.mount_point();
|
||||||
let total_space = byte_unit::Byte::from_u64(disk.total_space())
|
let total_space = byte_unit::Byte::from_u64(disk.total_space())
|
||||||
.get_appropriate_unit(UnitType::Binary)
|
.get_appropriate_unit(UnitType::Binary);
|
||||||
.to_string();
|
|
||||||
format!(
|
format!(
|
||||||
"{}: {} {} ({}, {}) {}",
|
"{}: {} {:>+5.1} ({}, {}) {}",
|
||||||
i,
|
i,
|
||||||
name,
|
name,
|
||||||
total_space,
|
total_space,
|
||||||
|
|
Loading…
Reference in a new issue