too-many-lists/deque/symmetric #1175
Replies: 4 comments 3 replies
-
pub fn peek_front_mut(&mut self) -> Option<RefMut<T>> {
self.head.as_ref().map(|node| {
RefMut::map(node.borrow_mut(), |node| &mut node.elem)
}) 这里的参数为什么要使用可变的self,而不使用不可变的self pub fn peek_mut_head(&self)-> Option<RefMut<T>>{
self.head.as_ref().map(|node|{
RefMut::map(node.borrow_mut(),|node|&mut node.val)
})
} 这样写编译器也没报错 |
Beta Was this translation helpful? Give feedback.
3 replies
-
我这里需要 (**node) 主动defre |
Beta Was this translation helpful? Give feedback.
0 replies
-
pub fn peek_back(&self) -> Option<Ref> { |
Beta Was this translation helpful? Give feedback.
0 replies
-
我说,总座高见 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
too-many-lists/deque/symmetric
https://course.rs/too-many-lists/deque/symmetric.html
Beta Was this translation helpful? Give feedback.
All reactions