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

Switch to quick-xml #1251

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

GuillaumeGomez
Copy link
Member

@GuillaumeGomez GuillaumeGomez commented Nov 1, 2021

Fixes #1235.

I spent way too much time on this so I'll stop now. If now feels like taking over, here you go.

I think the whole parser should be rewritten so that we don't need the weird layout we currently have. However, be warned: quick-xml API is horrible which can lead to errors like this:

error[E0499]: cannot borrow `*buf` as mutable more than once at a time
  --> src/xmlparser.rs:75:42
   |
73 |     pub fn next_element<'a, 'b: 'a>(&mut self, buf: &'b mut Vec<u8>) -> Result<BytesStart<'a>, String> {
   |                         -- lifetime `'a` defined here
74 |         loop {
75 |             return match self.next_event(buf) {
   |                                          ^^^ `*buf` was mutably borrowed here in the previous iteration of the loop
76 |                 Ok(Event::Start(e)) => Ok(e),
   |                                        ----- returning this value requires that `*buf` is borrowed for `'a`

The macros I added could be useful.

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

Successfully merging this pull request may close these issues.

Switch from xml-rs to quick-xml
1 participant