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

Implement the position trait for the Events Iterator

Open jose-pr opened this issue 3 years ago • 0 comments

I would like to utilize the position from the events iterator without having to consume it to get the reader.

I imagine this is all it would take.

impl<R: Read> Position for Events<R>
{
    fn position(&self) -> xml::common::TextPosition {
        self.reader.position()
    }
}

or have the option to call the EventReader by reference just like it is possible for the source.

impl<R: Read> Events<R> {
    /// Unwraps the iterator, returning the internal `EventReader`.
    #[inline]
    pub fn into_inner(self) -> EventReader<R> {
        self.reader
    }
   pub fn reader(&self) -> &EventReader<R> { &self.reader }
   pub fn reader_mut(&mut self) -> &mut EventReader<R> { &mut self.reader }
   pub fn source(&self) -> &R { &self.reader.source }
   pub fn source_mut(&mut self) -> &mut R { &mut self.reader.source }

}

jose-pr avatar Aug 13 '21 05:08 jose-pr