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

Method next

crates/vm/src/builtins/memory.rs:1214–1223  ·  view source on GitHub ↗
(zelf: &Py<Self>, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

1212impl SelfIter for PyMemoryViewIterator {}
1213impl IterNext for PyMemoryViewIterator {
1214 fn next(zelf: &Py<Self>, vm: &VirtualMachine) -> PyResult<PyIterReturn> {
1215 zelf.internal.lock().next(|mv, pos| {
1216 let len = mv.__len__(vm)?;
1217 Ok(if pos >= len {
1218 PyIterReturn::StopIteration(None)
1219 } else {
1220 PyIterReturn::Return(mv.getitem_by_idx(pos.try_into().unwrap(), vm)?)
1221 })
1222 })
1223 }
1224}

Callers

nothing calls this directly

Calls 4

getitem_by_idxMethod · 0.80
lockMethod · 0.45
__len__Method · 0.45
unwrapMethod · 0.45

Tested by

no test coverage detected