too-many-lists/unsafe-queue/extra-junk #719
Replies: 2 comments 3 replies
-
Iter 和 IterMut 實作中的 真的要對的話要用以下的 as_ref & as_mut 才會過: unsafe {
self.next = node.next.as_ref();
}
...
unsafe {
self.next = node.next.as_mut();
} |
Beta Was this translation helpful? Give feedback.
2 replies
-
pub fn peek(&self) -> Option<&T> {
Some(unsafe { &(*self.head).elem })
}
pub fn peek_mut(&mut self) -> Option<&mut T> {
Some(unsafe { &mut (*self.head).elem })
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
too-many-lists/unsafe-queue/extra-junk
https://course.rs/too-many-lists/unsafe-queue/extra-junk.html
Beta Was this translation helpful? Give feedback.
All reactions