Closed
Description
I ran into a problem with matching instruction id's to their enum counter parts defined in capstone-sys. Because rust does not have a provide a simple/safe way to cast a u32 to an enum value matching something like instruction id's to a list of possible instructions seems to get tricky.
This applies to instruction ID's as well as reg_ids, op_types and all the other capstone-sys enums.
For example it would be nice to have code as clean as:
fn is_valid_ret(insn: &Insn) -> bool {
match insn.id().0 {
x86_insn::X86_INS_RET => true,
_ => false
}
}
Maybe the bindgen could be changed for capstone-sys to output constants instead of enums for these types of values? Or am I missing something defined in capstone-sys?