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

Method peek_mut

code/chapter03/linked_list.rs:59–61  ·  view source on GitHub ↗

peek_mut 可改变值,是可变引用

(&mut self)

Source from the content-addressed store, hash-verified

57
58 // peek_mut 可改变值,是可变引用
59 pub fn peek_mut(&mut self) -> Option<&mut T> {
60 self.head.as_mut().map(|node| &mut node.elem )
61 }
62
63 // 以下是实现的三种迭代功能
64 // into_iter: 链表改变,成为迭代器

Callers 1

basic_testFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected