(text: &Wtf8)
| 256 | } |
| 257 | |
| 258 | fn parse_number(text: &Wtf8) -> Result<(Option<usize>, &Wtf8), FormatSpecError> { |
| 259 | let num_digits: usize = get_num_digits(text); |
| 260 | if num_digits == 0 { |
| 261 | return Ok((None, text)); |
| 262 | } |
| 263 | if let Some(num) = parse_usize(&text[..num_digits]) { |
| 264 | Ok((Some(num), &text[num_digits..])) |
| 265 | } else { |
| 266 | // NOTE: this condition is different from CPython |
| 267 | Err(FormatSpecError::DecimalDigitsTooMany) |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | fn parse_alternate_form(text: &Wtf8) -> (bool, &Wtf8) { |
| 272 | let mut chars = text.code_points(); |
no test coverage detected