()
| 2571 | ) -> Result<Vec<FormatSegment>, ParserError> { |
| 2572 | let content = &raw[1..raw.len() - 1]; |
| 2573 | let error_at = |offset: usize, len: u32, message: &str| ParserError { |
| 2574 | message: message.to_owned(), |
| 2575 | span: Span { |
| 2576 | line: span.line, |
| 2577 | col: span.col + 1 + offset as u32, |
| 2578 | len, |
| 2579 | source_line: span.source_line.clone(), |
| 2580 | }, |
| 2581 | }; |
| 2582 | let bytes = content.as_bytes(); |
| 2583 | let mut segments = Vec::new(); |
| 2584 | let mut literal = String::new(); |
| 2585 | let mut piece_start = 0usize; |
| 2586 | let mut i = 0usize; |
| 2587 | while i < bytes.len() { |
| 2588 | match bytes[i] { |
| 2589 | b'\\' => i += 2, |
| 2590 | b'{' if bytes.get(i + 1) == Some(&b'{') => { |
| 2591 | literal.push_str(&self.process_string_escapes(&content[piece_start..i])); |
| 2592 | literal.push('{'); |
| 2593 | i += 2; |
| 2594 | piece_start = i; |
| 2595 | } |
| 2596 | b'}' if bytes.get(i + 1) == Some(&b'}') => { |
| 2597 | literal.push_str(&self.process_string_escapes(&content[piece_start..i])); |
| 2598 | literal.push('}'); |
| 2599 | i += 2; |
| 2600 | piece_start = i; |
| 2601 | } |
nothing calls this directly
no test coverage detected