Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/QMHTMY/RustBook
/ push
Method
push
publication/code/chapter08/binary_heap.rs:62–66 ·
view source on GitHub ↗
末尾添加一个数据,调整堆
(&mut self, val: i32)
Source
from the content-addressed store, hash-verified
60
61
// 末尾添加一个数据,调整堆
62
fn push(&mut self, val: i32) {
63
self.data.push(val);
64
self.size += 1;
65
self.move_up(self.size);
66
}
67
68
// 构建新堆
69
fn build_new(&mut self, arr: &[i32]) {
Callers
6
build_add
Method · 0.45
build_new
Method · 0.45
main
Function · 0.45
iter
Method · 0.45
iter_mut
Method · 0.45
next
Method · 0.45
Calls
1
move_up
Method · 0.45
Tested by
no test coverage detected