I'm trying to write a parser. A string's char_indices() -> CharIndices seems like a useful iterator for this. I can walk the chars and have their positions for error reporting. But when parsing it's also useful to look ahead, so I called peekable() on that iterator. That returned iterator has a peek() function, but it loses the offset() and as_str() functions in CharIndices. I don't see a way to get the underlying iterator in the public interface.
What do people use for parsing a file? Maybe I should create my own iterator that wraps the str slice and provides all these functions.