MCPcopy Index your code
hub / github.com/QMHTMY/RustBook / append

Method append

publication/code/chapter04/lvec.rs:71–77  ·  view source on GitHub ↗

栈末尾加入新的 LVec

(&mut self, other: &mut Self)

Source from the content-addressed store, hash-verified

69
70 // 栈末尾加入新的 LVec
71 fn append(&mut self, other: &mut Self) {
72 while let Some(node) = other.head.as_mut().take() {
73 self.push(node.elem);
74 other.head = node.next.take();
75 }
76 other.clear();
77 }
78
79 fn insert(&mut self, mut index: usize, elem: T) {
80 if index >= self.size { index = self.size; }

Callers 3

basicFunction · 0.45
mine_blockMethod · 0.45
mine_blockMethod · 0.45

Calls 2

pushMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected