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

Method push

code/chapter07/binary_heap.rs:66–70  ·  view source on GitHub ↗

末尾添加一个数据,调整堆

(&mut self, val: i32)

Source from the content-addressed store, hash-verified

64
65 // 末尾添加一个数据,调整堆
66 fn push(&mut self, val: i32) {
67 self.data.push(val);
68 self.size += 1;
69 self.move_up(self.size);
70 }
71
72 // 构建新堆
73 fn build_new(&mut self, arr: &[i32]) {

Callers 3

build_addMethod · 0.45
build_newMethod · 0.45
mainFunction · 0.45

Calls 1

move_upMethod · 0.45

Tested by

no test coverage detected