File tree Expand file tree Collapse file tree 3 files changed +11
-10
lines changed Expand file tree Collapse file tree 3 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ MSRV bumped to 1.56! Crate now uses Rust 2021 edition.
3737- [ #649 ] : Make features linkable and reference them in the docs.
3838- [ #619 ] : Allow to raise application errors in ` ElementWriter::write_inner_content `
3939 (and newly added ` ElementWriter::write_inner_content_async ` of course).
40+ - [ #662 ] : Get rid of some allocations during serde deserialization.
4041
4142[ #545 ] : https://github.com/tafia/quick-xml/pull/545
4243[ #580 ] : https://github.com/tafia/quick-xml/issues/580
@@ -47,6 +48,7 @@ MSRV bumped to 1.56! Crate now uses Rust 2021 edition.
4748[ #651 ] : https://github.com/tafia/quick-xml/pull/651
4849[ #660 ] : https://github.com/tafia/quick-xml/pull/660
4950[ #661 ] : https://github.com/tafia/quick-xml/pull/661
51+ [ #662 ] : https://github.com/tafia/quick-xml/pull/662
5052
5153
5254## 0.30.0 -- 2023-07-23
Original file line number Diff line number Diff line change @@ -289,9 +289,14 @@ where
289289 seed. deserialize ( de) . map ( Some )
290290 }
291291 // Stop iteration after reaching a closing tag
292- DeEvent :: End ( e) if e. name ( ) == self . start . name ( ) => Ok ( None ) ,
293- // This is a unmatched closing tag, so the XML is invalid
294- DeEvent :: End ( e) => Err ( DeError :: UnexpectedEnd ( e. name ( ) . as_ref ( ) . to_owned ( ) ) ) ,
292+ // The matching tag name is guaranteed by the reader if our
293+ // deserializer implementation is correct
294+ DeEvent :: End ( e) => {
295+ debug_assert_eq ! ( self . start. name( ) , e. name( ) ) ;
296+ // Consume End
297+ self . de . next ( ) ?;
298+ Ok ( None )
299+ }
295300 // We cannot get `Eof` legally, because we always inside of the
296301 // opened tag `self.start`
297302 DeEvent :: Eof => Err ( DeError :: UnexpectedEof ) ,
Original file line number Diff line number Diff line change @@ -2785,13 +2785,7 @@ where
27852785 V : Visitor < ' de > ,
27862786 {
27872787 match self . next ( ) ? {
2788- DeEvent :: Start ( e) => {
2789- let name = e. name ( ) . as_ref ( ) . to_vec ( ) ;
2790- let map = ElementMapAccess :: new ( self , e, fields) ?;
2791- let value = visitor. visit_map ( map) ?;
2792- self . read_to_end ( QName ( & name) ) ?;
2793- Ok ( value)
2794- }
2788+ DeEvent :: Start ( e) => visitor. visit_map ( ElementMapAccess :: new ( self , e, fields) ?) ,
27952789 DeEvent :: End ( e) => Err ( DeError :: UnexpectedEnd ( e. name ( ) . as_ref ( ) . to_owned ( ) ) ) ,
27962790 DeEvent :: Text ( _) => Err ( DeError :: ExpectedStart ) ,
27972791 DeEvent :: Eof => Err ( DeError :: UnexpectedEof ) ,
You can’t perform that action at this time.
0 commit comments