Need an example of using itertools::PutBack::put_back in a loop

#1

I am trying to use itertools::PutBack::put_back in a loop. It is the event loop of a lexical analyzer state machine. I keep running afoul of the borrow checker. Does anyone have an example of how to use put_back properly?

In particular, I will be iterating over the characters in a string.

#2

I saw your question over on stack overflow so I answered it there.

#3

Thank you! I will read your answer…
… Read it. Very helpful.