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

Method update_idxs

crates/vm/src/stdlib/itertools.rs:1116–1137  ·  view source on GitHub ↗
(&self, mut idxs: PyRwLockWriteGuard<'_, Vec<usize>>)

Source from the content-addressed store, hash-verified

1114 #[pyclass(with(IterNext, Iterable, Constructor))]
1115 impl PyItertoolsProduct {
1116 fn update_idxs(&self, mut idxs: PyRwLockWriteGuard<'_, Vec<usize>>) {
1117 if idxs.is_empty() {
1118 self.stop.store(true);
1119 return;
1120 }
1121
1122 let cur = self.cur.load();
1123 let lst_idx = &self.pools[cur].len() - 1;
1124
1125 if idxs[cur] == lst_idx {
1126 if cur == 0 {
1127 self.stop.store(true);
1128 return;
1129 }
1130 idxs[cur] = 0;
1131 self.cur.fetch_sub(1);
1132 self.update_idxs(idxs);
1133 } else {
1134 idxs[cur] += 1;
1135 self.cur.store(idxs.len() - 1);
1136 }
1137 }
1138 }
1139
1140 impl SelfIter for PyItertoolsProduct {}

Callers 1

nextMethod · 0.80

Calls 4

is_emptyMethod · 0.45
storeMethod · 0.45
loadMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected