I already received lots of useful feedback on other, smaller scale, problems and questions I had about the Rust language, and I'm grateful for that. Today I'm looking for a bit of code review
I have recently published Rust bindings for the bddisasm C library. The C library is a x86/x86_64 instruction decoder. It is fairly small, with a simple API, but outputs the results in a pretty complex structure with quite a lot of information provided, ranging from how to check if a CPU supports an instruction to in-depth information about the instruction operands. I attempted to wrap all of this into a idiomatic Rust API, following the API guidelines as close as I could.
There are two crates involved:
-
bddisasm-sys - this includes the FFI bindings (generated with
bindgen
) and nothing else - bddisasm - an attempt at a higher level API
The code for both is available here. I appreciate any kind of feedback, ranging from API design to directory structure, documentation, etc. I'm very much a beginner when it comes to Rust, and apart from some small projects and tools only I (and one or two other people) use I don't have much experience with the language.
I can't link to the docs yet because I'm still in the build queue on docs.rs at the moment.
At the moment I know that the documentation should be more in-depth, with more examples and I feel a bit uneasy about how I dumped all the source files in src
.
I generate the bindings at build time so you'll need libclang
in order to build it. I'm not sure how often this is encountered with other similar crates, but I know that this is considered an issue by some people.