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

Method peek_mut

publication/code/chapter04/stack.rs:51–54  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

49 }
50
51 fn peek_mut(&mut self) -> Option<&mut T> {
52 if 0 == self.size { return None; }
53 self.data.get_mut(self.size - 1)
54 }
55
56 // 以下是为栈实现的迭代功能
57 // into_iter: 栈改变,成为迭代器

Callers 1

peekFunction · 0.45

Calls 1

get_mutMethod · 0.45

Tested by

no test coverage detected