Is there some way to enumerate all public items in a crate, with canonical names and all types resolved?
The result of any calculation based on that enumeration does not have to be included in the crate itself.
Rustdoc has this information, but I don't know whether it can generate an index in json or similar serialization. Or is there a compiler debug flag to dump data after some stage that could produce this?
My motivation is mainly generating bindings, which can be done as a wrapper. cbindgen
already has this problem, and it is relatively simple, only looking for extern "C"
functions and #[repr(C)]
types with restricted content, so guessing what the names really mean works well enough. I am thinking about processing a more naturally written interfaces, for which having resolved types, and knowing about impls, would be important.