File tree Expand file tree Collapse file tree 1 file changed +23
-3
lines changed
Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -180,8 +180,19 @@ impl Sorter {
180180 match self . records . pop ( ) {
181181 Some ( ptr) => {
182182 // SAFETY: ptr is valid - arena hasn't been reset yet.
183- let record = unsafe { ptr. as_ref ( ) } ;
184- self . current = Some ( record. to_immutable_record ( ) ) ;
183+ let arena_record = unsafe { ptr. as_ref ( ) } ;
184+ let payload = arena_record. payload ( ) ;
185+
186+ match & mut self . current {
187+ Some ( record) => {
188+ record. invalidate ( ) ;
189+ record. start_serialization ( payload) ;
190+ }
191+ None => {
192+ self . current = Some ( arena_record. to_immutable_record ( ) ) ;
193+ }
194+ }
195+
185196 if self . records . is_empty ( ) {
186197 self . arena . reset ( ) ;
187198 }
@@ -195,7 +206,16 @@ impl Sorter {
195206 if let Some ( ref error) = boxed_record. deserialization_error {
196207 return Err ( error. clone ( ) ) ;
197208 }
198- self . current = Some ( boxed_record. record ) ;
209+ let payload = boxed_record. record . get_payload ( ) ;
210+ match & mut self . current {
211+ Some ( record) => {
212+ record. invalidate ( ) ;
213+ record. start_serialization ( payload) ;
214+ }
215+ None => {
216+ self . current = Some ( boxed_record. record ) ;
217+ }
218+ }
199219 }
200220 None => self . current = None ,
201221 }
You can’t perform that action at this time.
0 commit comments