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

Method fast_next

crates/vm/src/builtins/list.rs:711–723  ·  view source on GitHub ↗

Fast path for FOR_ITER specialization.

(&self)

Source from the content-addressed store, hash-verified

709impl PyListIterator {
710 /// Fast path for FOR_ITER specialization.
711 pub(crate) fn fast_next(&self) -> Option<PyObjectRef> {
712 self.internal
713 .lock()
714 .next(|list, pos| {
715 let vec = list.borrow_vec();
716 Ok(PyIterReturn::from_result(vec.get(pos).cloned().ok_or(None)))
717 })
718 .ok()
719 .and_then(|r| match r {
720 PyIterReturn::Return(v) => Some(v),
721 PyIterReturn::StopIteration(_) => None,
722 })
723 }
724}
725
726impl SelfIter for PyListIterator {}

Callers 2

execute_instructionMethod · 0.45
execute_for_iterMethod · 0.45

Calls 6

okMethod · 0.80
borrow_vecMethod · 0.80
SomeClass · 0.50
nextMethod · 0.45
lockMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected