use std::slice::Iter; use std::str::Chars; impl<'keyword> crate::KeywordComparatorIterator<'keyword, char> for Chars<'keyword> { fn consume(&mut self, e: char) -> bool { return self.next().is_some_and(|a| a == e); } } impl crate::Keyword for &str { fn startComparation<'keyword>( &'keyword self, expectedLen: usize, ) -> Option> { if (self.len() != expectedLen) { return Option::None; } return Option::Some(self.chars()); } } impl crate::Keyword for &String { fn startComparation<'keyword>( &'keyword self, expectedLen: usize, ) -> Option> { if (self.len() != expectedLen) { return Option::None; } return Option::Some(self.chars()); } } impl<'keyword, C: PartialEq> crate::KeywordComparatorIterator<'keyword, C> for Iter<'keyword, C> { fn consume(&mut self, e: C) -> bool { return self.next().is_some_and(|a| a.eq(&e)); } } impl crate::Keyword for &[C] { fn startComparation<'keyword>( &'keyword self, expectedLen: usize, ) -> Option> { if (self.len() != expectedLen) { return Option::None; } return Option::Some(self.iter()); } } impl crate::Keyword for &[C; SZ] { fn startComparation<'keyword>( &'keyword self, expectedLen: usize, ) -> Option> { if (self.len() != expectedLen) { return Option::None; } return Option::Some(self.iter()); } }