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

Method append

code/chapter03/lvec.rs:70–76  ·  view source on GitHub ↗

栈末尾加入数据

(&mut self, other: &mut Self)

Source from the content-addressed store, hash-verified

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

Callers 3

mainFunction · 0.45
mine_blockMethod · 0.45
mine_blockMethod · 0.45

Calls 2

pushMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected