How to list all the modules/methods/types used by a Rust crate

How would one go about getting a list of "fully-named" method and types used by a create? By "full name" I mean a tuple like (external crate, module path in that crate, method or type name).

The use case is to validate that, let's say, a string manipulation library is not doing file access or TCP/IP communication.

Just knowing which external crates are referenced would not be enough, as "std" has so much functionality.

I was thinking of looking at the LLVM-IR or the ASM output and unscrambling symbol names. Or maybe this can be extracted from the debug info?

1 Like