Format a byte count for display.
(bytes: u64)
| 404 | |
| 405 | /// Format a byte count for display. |
| 406 | fn format_bytes(bytes: u64) -> String { |
| 407 | if bytes >= 1024 * 1024 { |
| 408 | format!("{:.1} MB", bytes as f64 / (1024.0 * 1024.0)) |
| 409 | } else if bytes >= 1024 { |
| 410 | format!("{:.1} KB", bytes as f64 / 1024.0) |
| 411 | } else { |
| 412 | format!("{} B", bytes) |
| 413 | } |
| 414 | } |
| 415 | |
| 416 | // ============================================================================= |
| 417 | // Error Conversion |
nothing calls this directly
no outgoing calls
no test coverage detected