quick-xml icon indicating copy to clipboard operation
quick-xml copied to clipboard

Is there any way to read an event and not consume it?

Open ImJeremyHe opened this issue 2 years ago • 1 comments

just like peek() in the iterators

ImJeremyHe avatar Jul 09 '22 15:07 ImJeremyHe

Reader does not buffer events that it reads, so you cannot peek them, but you can create your own wrapper around the reader that would store the last readed event. That approach is used in the Deserializer: https://github.com/tafia/quick-xml/blob/2eecf00ee62e8b15d79724d63661c3abc582dd7a/src/de/mod.rs#L473-L486

We could introduce a PeekableReader that will have that logic. PR is welcome.

Mingun avatar Jul 09 '22 16:07 Mingun