(&'a self, f: impl Fn(&'a str) -> I)
| 917 | } |
| 918 | |
| 919 | pub fn map_utf8<'a, I>(&'a self, f: impl Fn(&'a str) -> I) -> impl Iterator<Item = CodePoint> |
| 920 | where |
| 921 | I: Iterator<Item = char>, |
| 922 | { |
| 923 | self.chunks().flat_map(move |chunk| match chunk { |
| 924 | Wtf8Chunk::Utf8(s) => Either::Left(f(s).map_into()), |
| 925 | Wtf8Chunk::Surrogate(c) => Either::Right(core::iter::once(c)), |
| 926 | }) |
| 927 | } |
| 928 | |
| 929 | #[inline] |
| 930 | fn next_surrogate(&self, mut pos: usize) -> Option<(usize, u16)> { |