feat: display blank 0

This commit is contained in:
Kristofers Solo 2024-02-21 15:33:43 +02:00
parent c17c0ebffa
commit 2a3975963c
2 changed files with 6 additions and 0 deletions

View File

@ -24,6 +24,9 @@ impl FileSize {
impl ToString for FileSize {
fn to_string(&self) -> String {
if self.0 == 0 {
return "0".to_string();
}
match self.0 as f64 {
b if b >= 1e12 => self.to_tb(),
b if b >= 1e9 => self.to_gb(),

View File

@ -20,6 +20,9 @@ impl NetSpeed {
impl ToString for NetSpeed {
fn to_string(&self) -> String {
if self.0 == 0 {
return "0".to_string();
}
match self.0 as f64 {
b if b >= 1e9 => self.to_gbps(),
b if b >= 1e6 => self.to_mbps(),