Ehh you shouldn't need to
Why not use an index instead of counting characters? Or return the index of the failure?
Using '&str' could be useful for easier comparisons too
or even if you have some real complex parsing logic , using a state structure could be useful. Could even create a struct to encapsulate the parser state, including the current index and other info