Format a byte count for display.
(bytes: u64)
| 350 | |
| 351 | /// Format a byte count for display. |
| 352 | fn format_bytes(bytes: u64) -> String { |
| 353 | if bytes >= 1024 * 1024 { |
| 354 | format!("{:.1} MB", bytes as f64 / (1024.0 * 1024.0)) |
| 355 | } else if bytes >= 1024 { |
| 356 | format!("{:.1} KB", bytes as f64 / 1024.0) |
| 357 | } else { |
| 358 | format!("{} B", bytes) |
| 359 | } |
| 360 | } |
| 361 | |
| 362 | // Error Conversion |
| 363 |
nothing calls this directly
no outgoing calls
no test coverage detected