rust-lang / rust-bindgen

Automatically generates Rust FFI bindings to C (and some C++) libraries.
https://rust-lang.github.io/rust-bindgen/
BSD 3-Clause "New" or "Revised" License
4.48k stars 699 forks source link

CLI integration with doxygen-rs? #2953

Open kornelski opened 1 month ago

kornelski commented 1 month ago

Doxygen seems to be commonly used in C/C++ projects, and its annotations look pretty messy in Rustdoc.

bindgen chose to offload processing of Doxygen annotations to doxygen-rs. The problem is that the process_comment callback used as an integration point exists only in the bindgen's Rust API.

In my crates, I generally avoid using bindgen at build time, and have workflows based around running bindgen-cli instead. Having to replace shell one-liners with Rust programs is inconvenient.

Could bindgen-cli have some way of supporting doxygen annotations?

Add doxygen-rs as an optional Cargo feature? Or if you want bindgen to remain completely agnostic, maybe support filtering of comments by through stdin/stdout of a command? (so that doxygen-rs could provide an executable for this)

pvdrz commented 1 month ago

This might be relevant: https://github.com/rust-lang/rust-bindgen/issues/2949#issuecomment-2419825519