MCPcopy Create free account
hub / github.com/QMHTMY/RustBook / drop

Method drop

publication/code/chapter07/tim_sort.rs:286–298  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

284
285impl<'a> Drop for MergeLo<'a> {
286 fn drop(&mut self) {
287 unsafe {
288 // 将 temp 中剩余的值放到 list 高位
289 if self.first_pos < self.first_len {
290 ptr::copy_nonoverlapping(
291 self.temp.get_unchecked(self.first_pos),
292 self.list.get_unchecked_mut(self.dest_pos),
293 self.first_len - self.first_pos,
294 );
295 }
296 self.temp.set_len(0);
297 }
298 }
299}
300
301// 合并 B、C 为一个 run

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected