Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/QMHTMY/RustBook
/ clear
Method
clear
publication/code/chapter04/stack.rs:27–30 ·
view source on GitHub ↗
清空栈
(&mut self)
Source
from the content-addressed store, hash-verified
25
26
// 清空栈
27
fn clear(&mut self) {
28
self.size = 0;
29
self.data.clear();
30
}
31
32
// 数据保存在 Vec 末尾
33
fn push(&mut self, val: T) {
Callers
1
basic
Function · 0.45
Calls
no outgoing calls
Tested by
no test coverage detected