(value: u64)
| 1394 | } |
| 1395 | |
| 1396 | fn format_number(value: u64) -> String { |
| 1397 | let digits = value.to_string(); |
| 1398 | let mut out = String::with_capacity(digits.len() + (digits.len() / 3)); |
| 1399 | for (idx, ch) in digits.chars().rev().enumerate() { |
| 1400 | if idx > 0 && idx % 3 == 0 { |
| 1401 | out.push(','); |
| 1402 | } |
| 1403 | out.push(ch); |
| 1404 | } |
| 1405 | out.chars().rev().collect() |
| 1406 | } |