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

Method _next

crates/vm/src/builtins/iter.rs:94–110  ·  view source on GitHub ↗
(&mut self, f: F, op: OP)

Source from the content-addressed store, hash-verified

92 }
93
94 fn _next<F, OP>(&mut self, f: F, op: OP) -> PyResult<PyIterReturn>
95 where
96 F: FnOnce(&T, usize) -> PyResult<PyIterReturn>,
97 OP: FnOnce(&mut Self),
98 {
99 if let IterStatus::Active(obj) = &self.status {
100 let ret = f(obj, self.position);
101 if let Ok(PyIterReturn::Return(_)) = ret {
102 op(self);
103 } else {
104 self.status = IterStatus::Exhausted;
105 }
106 ret
107 } else {
108 Ok(PyIterReturn::StopIteration(None))
109 }
110 }
111
112 pub fn next<F>(&mut self, f: F) -> PyResult<PyIterReturn>
113 where

Callers 2

nextMethod · 0.45
rev_nextMethod · 0.45

Calls 1

fFunction · 0.50

Tested by

no test coverage detected