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

Method peek_mut

publication/code/chapter04/linked_list.rs:64–66  ·  view source on GitHub ↗

peek_mut 可改变值,是可变引用

(&mut self)

Source from the content-addressed store, hash-verified

62
63 // peek_mut 可改变值,是可变引用
64 fn peek_mut(&mut self) -> Option<&mut T> {
65 self.head.as_mut().map(|node| &mut node.elem )
66 }
67
68 // 以下是为链表实现的迭代功能
69 // into_iter: 链表改变,成为迭代器

Callers 1

basic_testFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected