@@ -2066,42 +2066,6 @@ impl<'i, R: XmlRead<'i>> XmlReader<'i, R> {
20662066
20672067////////////////////////////////////////////////////////////////////////////////////////////////////
20682068
2069- /// A structure that deserializes XML into Rust values.
2070- pub struct Deserializer < ' de , R >
2071- where
2072- R : XmlRead < ' de > ,
2073- {
2074- /// An XML reader that streams events into this deserializer
2075- reader : XmlReader < ' de , R > ,
2076-
2077- /// When deserializing sequences sometimes we have to skip unwanted events.
2078- /// That events should be stored and then replayed. This is a replay buffer,
2079- /// that streams events while not empty. When it exhausted, events will
2080- /// requested from [`Self::reader`].
2081- #[ cfg( feature = "overlapped-lists" ) ]
2082- read : VecDeque < DeEvent < ' de > > ,
2083- /// When deserializing sequences sometimes we have to skip events, because XML
2084- /// is tolerant to elements order and even if in the XSD order is strictly
2085- /// specified (using `xs:sequence`) most of XML parsers allows order violations.
2086- /// That means, that elements, forming a sequence, could be overlapped with
2087- /// other elements, do not related to that sequence.
2088- ///
2089- /// In order to support this, deserializer will scan events and skip unwanted
2090- /// events, store them here. After call [`Self::start_replay()`] all events
2091- /// moved from this to [`Self::read`].
2092- #[ cfg( feature = "overlapped-lists" ) ]
2093- write : VecDeque < DeEvent < ' de > > ,
2094- /// Maximum number of events that can be skipped when processing sequences
2095- /// that occur out-of-order. This field is used to prevent potential
2096- /// denial-of-service (DoS) attacks which could cause infinite memory
2097- /// consumption when parsing a very large amount of XML into a sequence field.
2098- #[ cfg( feature = "overlapped-lists" ) ]
2099- limit : Option < NonZeroUsize > ,
2100-
2101- #[ cfg( not( feature = "overlapped-lists" ) ) ]
2102- peek : Option < DeEvent < ' de > > ,
2103- }
2104-
21052069/// Deserialize an instance of type `T` from a string of XML text.
21062070pub fn from_str < ' de , T > ( s : & ' de str ) -> Result < T , DeError >
21072071where
@@ -2166,6 +2130,44 @@ where
21662130 }
21672131}
21682132
2133+ ////////////////////////////////////////////////////////////////////////////////////////////////////
2134+
2135+ /// A structure that deserializes XML into Rust values.
2136+ pub struct Deserializer < ' de , R >
2137+ where
2138+ R : XmlRead < ' de > ,
2139+ {
2140+ /// An XML reader that streams events into this deserializer
2141+ reader : XmlReader < ' de , R > ,
2142+
2143+ /// When deserializing sequences sometimes we have to skip unwanted events.
2144+ /// That events should be stored and then replayed. This is a replay buffer,
2145+ /// that streams events while not empty. When it exhausted, events will
2146+ /// requested from [`Self::reader`].
2147+ #[ cfg( feature = "overlapped-lists" ) ]
2148+ read : VecDeque < DeEvent < ' de > > ,
2149+ /// When deserializing sequences sometimes we have to skip events, because XML
2150+ /// is tolerant to elements order and even if in the XSD order is strictly
2151+ /// specified (using `xs:sequence`) most of XML parsers allows order violations.
2152+ /// That means, that elements, forming a sequence, could be overlapped with
2153+ /// other elements, do not related to that sequence.
2154+ ///
2155+ /// In order to support this, deserializer will scan events and skip unwanted
2156+ /// events, store them here. After call [`Self::start_replay()`] all events
2157+ /// moved from this to [`Self::read`].
2158+ #[ cfg( feature = "overlapped-lists" ) ]
2159+ write : VecDeque < DeEvent < ' de > > ,
2160+ /// Maximum number of events that can be skipped when processing sequences
2161+ /// that occur out-of-order. This field is used to prevent potential
2162+ /// denial-of-service (DoS) attacks which could cause infinite memory
2163+ /// consumption when parsing a very large amount of XML into a sequence field.
2164+ #[ cfg( feature = "overlapped-lists" ) ]
2165+ limit : Option < NonZeroUsize > ,
2166+
2167+ #[ cfg( not( feature = "overlapped-lists" ) ) ]
2168+ peek : Option < DeEvent < ' de > > ,
2169+ }
2170+
21692171impl < ' de , R > Deserializer < ' de , R >
21702172where
21712173 R : XmlRead < ' de > ,
0 commit comments