Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement the position trait for the Events Iterator #209

Open
jose-pr opened this issue Aug 13, 2021 · 0 comments
Open

Implement the position trait for the Events Iterator #209

jose-pr opened this issue Aug 13, 2021 · 0 comments
Assignees

Comments

@jose-pr
Copy link

jose-pr commented Aug 13, 2021

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 }

}
@kornelski kornelski self-assigned this May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants