feat(sync): Added implementation for better data view in strict
This commit is contained in:
1 parent
1e1d452b66
commit
e42ab8469e
1 file changed
+15
@@ -55,6 +55,21 @@ pub struct SyncStats {
|
|||||||
pub transfer_speed: f64, // в байтах в секунду
|
pub transfer_speed: f64, // в байтах в секунду
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl SyncStats {
|
||||||
|
pub fn format_speed(&self) -> String {
|
||||||
|
let speed = self.transfer_speed;
|
||||||
|
if speed < 1024.0 {
|
||||||
|
format!("{:.0} B/s", speed)
|
||||||
|
} else if speed < 1024.0 * 1024.0 {
|
||||||
|
format!("{:.1} KB/s", speed / 1024.0)
|
||||||
|
} else if speed < 1024.0 * 1024.0 * 1024.0 {
|
||||||
|
format!("{:.1} MB/s", speed / (1024.0 * 1024.0))
|
||||||
|
} else {
|
||||||
|
format!("{:.2} GB/s", speed / (1024.0 * 1024.0 * 1024.0))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default)]
|
||||||
pub struct CopyOptions {
|
pub struct CopyOptions {
|
||||||
pub verbose: bool,
|
pub verbose: bool,
|
||||||
|
|||||||
Reference in new issue
Block a user