(input: &'a str, pattern: &[char])
| 65 | impl Trimmer for TrimLeft { |
| 66 | #[inline] |
| 67 | fn trim<'a>(input: &'a str, pattern: &[char]) -> (&'a str, u32) { |
| 68 | if pattern.len() == 1 && pattern[0].is_ascii() { |
| 69 | return Self::trim_ascii_char(input, pattern[0] as u8); |
| 70 | } |
| 71 | let trimmed = input.trim_start_matches(pattern); |
| 72 | let offset = (input.len() - trimmed.len()) as u32; |
| 73 | (trimmed, offset) |
| 74 | } |
| 75 | |
| 76 | #[inline] |
| 77 | fn trim_ascii_char(input: &str, byte: u8) -> (&str, u32) { |