(&mut self)
| 579 | type Item = CpgIter; |
| 580 | |
| 581 | fn next(&mut self) -> Option<CpgIter> { |
| 582 | let mut c_iter_description = ffi::cpg_iteration_description_t { |
| 583 | nodeid: 0, |
| 584 | pid: 0, |
| 585 | group: ffi::cpg_name { |
| 586 | length: 0_u32, |
| 587 | value: [0; CPG_NAMELEN_MAX], |
| 588 | }, |
| 589 | }; |
| 590 | let res = unsafe { ffi::cpg_iteration_next(self.iter_handle, &mut c_iter_description) }; |
| 591 | |
| 592 | if res == ffi::CS_OK { |
| 593 | let r_group = |
| 594 | match string_from_bytes(c_iter_description.group.value.as_ptr(), CPG_NAMELEN_MAX) { |
| 595 | Ok(groupname) => groupname, |
| 596 | Err(_) => return None, |
| 597 | }; |
| 598 | Some(CpgIter { |
| 599 | group: r_group, |
| 600 | nodeid: NodeId::from(c_iter_description.nodeid), |
| 601 | pid: c_iter_description.pid, |
| 602 | }) |
| 603 | } else if res == ffi::CS_ERR_NO_SECTIONS { |
| 604 | // End of list |
| 605 | unsafe { |
| 606 | // Yeah, we don't check this return code. There's nowhere to report it. |
| 607 | ffi::cpg_iteration_finalize(self.iter_handle) |
| 608 | }; |
| 609 | None |
| 610 | } else { |
| 611 | None |
| 612 | } |
| 613 | } |
| 614 | } |
| 615 | |
| 616 | impl CpgIterStart { |
nothing calls this directly
no test coverage detected