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

Method iter_next

wasm-pdk/src/lib.rs:608–620  ·  view source on GitHub ↗

`next(recv)`; returns `Ok(None)` at end-of-iteration, propagates other errors.

(&self)

Source from the content-addressed store, hash-verified

606
607 /// `next(recv)`; returns `Ok(None)` at end-of-iteration, propagates other errors.
608 pub fn iter_next(&self) -> Result<Option<Handle>> {
609 let mut out: u32 = 0;
610 let r = unsafe {
611 edge_op(op::ITER_NEXT, self.raw, core::ptr::null(), 0, core::ptr::null(), 0, &mut out as *mut u32)
612 };
613 if r != 0 {
614 let e = last_error();
615 // Host renders the sentinel as "Exception: StopIteration", so match anywhere.
616 if e.message().contains("StopIteration") { return Ok(None); }
617 return Err(e);
618 }
619 Ok(Some(Handle::from_raw(out)))
620 }
621}
622
623/* Plugin-class state helpers */

Callers 3

distFunction · 0.80
fsumFunction · 0.80
prodFunction · 0.80

Calls 3

last_errorFunction · 0.85
containsMethod · 0.45
messageMethod · 0.45

Tested by

no test coverage detected