Skip to content

Switch to quick-xml#1251

Draft
GuillaumeGomez wants to merge 1 commit intogtk-rs:mainfrom
GuillaumeGomez:quick-xml
Draft

Switch to quick-xml#1251
GuillaumeGomez wants to merge 1 commit intogtk-rs:mainfrom
GuillaumeGomez:quick-xml

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