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

Method push

publication/code/chapter04/stack.rs:33–36  ·  view source on GitHub ↗

数据保存在 Vec 末尾

(&mut self, val: T)

Source from the content-addressed store, hash-verified

31
32 // 数据保存在 Vec 末尾
33 fn push(&mut self, val: T) {
34 self.data.push(val);
35 self.size += 1;
36 }
37
38 // 栈顶减 1 后再弹出数据
39 fn pop(&mut self) -> Option<T> {

Callers 5

iterMethod · 0.45
iter_mutMethod · 0.45
basicFunction · 0.45
peekFunction · 0.45
iterFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected