@@ -451,7 +451,7 @@ impl<R> Reader<R> {
451451 }
452452}
453453
454- /// Private methods
454+ /// Private sync reading methods
455455impl < R > Reader < R > {
456456 /// Read text into the given buffer, and return an event that borrows from
457457 /// either that buffer or from the input itself, based on the type of the
@@ -545,7 +545,10 @@ impl<R> Reader<R> {
545545 Err ( e) => Err ( e) ,
546546 }
547547 }
548+ }
548549
550+ /// Parse methods, independent from a way of reading data
551+ impl < R > Reader < R > {
549552 /// Trims whitespaces from `bytes`, if required, and returns a [`StartText`]
550553 /// or a [`Text`] event. When [`StartText`] is returned, the method can change
551554 /// the encoding of the reader, detecting it from the beginning of the stream.
@@ -693,15 +696,6 @@ impl<R> Reader<R> {
693696 }
694697 }
695698
696- #[ inline]
697- fn close_expanded_empty ( & mut self ) -> Result < Event < ' static > > {
698- self . tag_state = TagState :: Closed ;
699- let name = self
700- . opened_buffer
701- . split_off ( self . opened_starts . pop ( ) . unwrap ( ) ) ;
702- Ok ( Event :: End ( BytesEnd :: wrap ( name. into ( ) ) ) )
703- }
704-
705699 /// reads `BytesElement` starting with any character except `/`, `!` or ``?`
706700 /// return `Start` or `Empty` event
707701 fn read_start < ' b > ( & mut self , buf : & ' b [ u8 ] ) -> Result < Event < ' b > > {
@@ -726,6 +720,15 @@ impl<R> Reader<R> {
726720 Ok ( Event :: Start ( BytesStart :: wrap ( buf, name_end) ) )
727721 }
728722 }
723+
724+ #[ inline]
725+ fn close_expanded_empty ( & mut self ) -> Result < Event < ' static > > {
726+ self . tag_state = TagState :: Closed ;
727+ let name = self
728+ . opened_buffer
729+ . split_off ( self . opened_starts . pop ( ) . unwrap ( ) ) ;
730+ Ok ( Event :: End ( BytesEnd :: wrap ( name. into ( ) ) ) )
731+ }
729732}
730733
731734////////////////////////////////////////////////////////////////////////////////////////////////////
0 commit comments