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

Method next

crates/stdlib/src/pystruct.rs:203–215  ·  view source on GitHub ↗
(zelf: &Py<Self>, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

201
202 impl IterNext for UnpackIterator {
203 fn next(zelf: &Py<Self>, vm: &VirtualMachine) -> PyResult<PyIterReturn> {
204 let size = zelf.format_spec.size;
205 let offset = zelf.offset.fetch_add(size);
206 zelf.buffer.with_ref(|buf| {
207 if let Some(buf) = buf.get(offset..offset + size) {
208 zelf.format_spec
209 .unpack(buf, vm)
210 .map(|x| PyIterReturn::Return(x.into()))
211 } else {
212 Ok(PyIterReturn::StopIteration(None))
213 }
214 })
215 }
216 }
217
218 #[pyfunction]

Callers

nothing calls this directly

Calls 4

with_refMethod · 0.80
getMethod · 0.45
mapMethod · 0.45
unpackMethod · 0.45

Tested by

no test coverage detected