MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / dispatch_iter_next

Function dispatch_iter_next

compiler/src/main/abi_bridge.rs:200–212  ·  view source on GitHub ↗

IterNext: pops list head; raises StopIteration when empty. */

(recv_h: u32)

Source from the content-addressed store, hash-verified

198
199/* IterNext: pops list head; raises StopIteration when empty. */
200fn dispatch_iter_next(recv_h: u32) -> Result<Val, VmErr> {
201 with_recv("edge_op iter_next: invalid receiver handle", recv_h, |vm, recv| {
202 if let HeapObj::List(rc) = vm.heap.get(recv) {
203 let mut v = rc.borrow_mut();
204 if v.is_empty() {
205 return Err(VmErr::Raised(s!("StopIteration")));
206 }
207 Ok(v.remove(0))
208 } else {
209 Err(VmErr::TypeMsg(s!("iter_next expects a List iterator (produced by Op::Iter), got '", str vm.type_name(recv), "'")))
210 }
211 })
212}
213
214fn dispatch_new_dict() -> Result<Val, VmErr> {
215 in_vm("edge_op new_dict called outside run()", |vm| vm.heap.alloc(HeapObj::Dict(Rc::new(RefCell::new(DictMap::new())))))

Callers 1

host_edge_opFunction · 0.85

Calls 4

with_recvFunction · 0.85
removeMethod · 0.80
getMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected