MCPcopy Index your code
hub / github.com/RustPython/RustPython / pop_front

Method pop_front

crates/common/src/linked_list.rs:205–216  ·  view source on GitHub ↗

Removes the first element from the list and returns it, or None if empty.

(&mut self)

Source from the content-addressed store, hash-verified

203
204 /// Removes the first element from the list and returns it, or None if empty.
205 pub fn pop_front(&mut self) -> Option<L::Handle> {
206 let head = self.head?;
207 unsafe {
208 self.head = L::pointers(head).as_ref().get_next();
209 if let Some(new_head) = self.head {
210 L::pointers(new_head).as_mut().set_prev(None);
211 }
212 L::pointers(head).as_mut().set_next(None);
213 L::pointers(head).as_mut().set_prev(None);
214 Some(L::from_raw(head))
215 }
216 }
217
218 /// Returns whether the linked list does not contain any node
219 pub const fn is_empty(&self) -> bool {

Callers 5

freezeMethod · 0.80
unfreezeMethod · 0.80
appendMethod · 0.80
popleftMethod · 0.80
mark_coldFunction · 0.80

Calls 6

get_nextMethod · 0.80
set_prevMethod · 0.80
SomeClass · 0.50
as_refMethod · 0.45
as_mutMethod · 0.45
set_nextMethod · 0.45

Tested by

no test coverage detected