too-many-lists/unsafe-queue/basics #1142
Replies: 1 comment 2 replies
-
请教个问题: pub fn pop(&mut self) -> Option<T> {
self.head.take().map(|head| {
// 为啥要加这一行呢
let head = *head;
self.head = head.next;
if self.head.is_none() {
self.tail = ptr::null_mut();
}
head.elem
})
} |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
too-many-lists/unsafe-queue/basics
https://course.rs/too-many-lists/unsafe-queue/basics.html
Beta Was this translation helpful? Give feedback.
All reactions