capstone-rust / capstone-rs

high-level Capstone system bindings for Rust
217 stars 75 forks source link

Cleanup instruction iterator #85

Closed ExPixel closed 3 years ago

ExPixel commented 4 years ago

Removed Instructions::iter() and InstructionIterator. The nice thing about having a deref to a slice is that it gives you an iter() method for free because of Rust's deref coercion. Also fixed some tests so that they use references to Insn instead and made Insn cloneable as well in case someone did want an Iterator<Item = Insn> instead of an Iterator<Item = &Insn>.

tmfink commented 4 years ago

Thanks for the PR! When I have more time, I can look into this in more detail.

ExPixel commented 4 years ago

So I changed RegsIter first and am holding off on making changes to the groups iterator. Just wanted to know what you think of the changes first.

tmfink commented 3 years ago

So I changed RegsIter first and am holding off on making changes to the groups iterator. Just wanted to know what you think of the changes first.

Sorry for the ultra late comment. I think the change looks good. Please feel free to apply that same pattern to the other iterators. If you would prefer, I could merge as-is and you can make a follow-up PR.