I have the following task in my project:
GIVEN: Rust library source code, rust application, analyze_lib_api($PATH_TO_PROJECT_WITH_LIB_RS) functionality
WHEN: analyze_lib_api(...) is called
THEN: List of exposed methods is returned, including their names, return types, arguments (with recursive field descriptions if they are structs, fully qualified types, with recursive args/return descriptions if they are lambdas and so on).
I tried to read and experiment a bit with rust compiler, using its code, but I'm a bit overwhelmed by its complexity and API.
As far as I understand, HIR might be the thing I need, but I cannot figure out how I could build only HIR and skip the rest of the pipeline (HIR building process seems to be tightly integrated with the rest of compilation, which I don't need)
Could someone, please, guide me a bit? I would be happy to get some promising direction to dig into. May be there are some libraries, which could be embedded and provide this sort of functionality? Or may be some components of RLS would be easier to reuse? Or may be there is a relatively simple way to call some set of methods in the compiler internal API, which I missed?
Information, returned by this API should be quite strict, as it will be used to create library bindings of specific custom format automatically (surely with long list of limitations and API design agreements).
Thank you in advance!