`next(recv)`; returns `Ok(None)` at end-of-iteration, propagates other errors.
(&self)
| 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 */ |