Formatted size
(&self)
| 492 | |
| 493 | // Formatted size |
| 494 | fn formatted_size(&self) -> (usize, String) |
| 495 | { |
| 496 | let count = self.blkcount() as usize; |
| 497 | let size = self.blksize() as usize; |
| 498 | let bytes = size * count; |
| 499 | |
| 500 | if bytes >> 20 < 1000 |
| 501 | { |
| 502 | (bytes >> 20, String::from("MB")) |
| 503 | } |
| 504 | else |
| 505 | { |
| 506 | (bytes >> 30, String::from("GB")) |
| 507 | } |
| 508 | } |
| 509 | } |
| 510 | |
| 511 |