tried asking ChatGPT but was no help. the question is how can i put an element back in an iterator? specifically a Peekable<Chars>.
here is the necessary code. its for a parser im writing. if a minus i followed by a number it should continue parsing the rest of the number, if else it should put the minus back in self.code and return Ok(()) to indicate that its done trying to parse a number.
Some('-') => {
num_string.push(self.code.next().unwrap());
if let Some('0'..='9') = self.code.peek() {
} else {
// put minus back on the in the code
return Ok(())
}
}