| 238 | } |
| 239 | |
| 240 | fn parse_fill_and_align(text: &Wtf8) -> (Option<CodePoint>, Option<FormatAlign>, &Wtf8) { |
| 241 | let char_indices: Vec<(usize, CodePoint)> = text.code_point_indices().take(3).collect(); |
| 242 | if char_indices.is_empty() { |
| 243 | (None, None, text) |
| 244 | } else if char_indices.len() == 1 { |
| 245 | let (maybe_align, remaining) = FormatAlign::parse(text); |
| 246 | (None, maybe_align, remaining) |
| 247 | } else { |
| 248 | let (maybe_align, remaining) = FormatAlign::parse(&text[char_indices[1].0..]); |
| 249 | if maybe_align.is_some() { |
| 250 | (Some(char_indices[0].1), maybe_align, remaining) |
| 251 | } else { |
| 252 | let (only_align, only_align_remaining) = FormatAlign::parse(text); |
| 253 | (None, only_align, only_align_remaining) |
| 254 | } |
| 255 | } |
| 256 | } |
| 257 | |
| 258 | fn parse_number(text: &Wtf8) -> Result<(Option<usize>, &Wtf8), FormatSpecError> { |
| 259 | let num_digits: usize = get_num_digits(text); |