I'm trying to understand a reasonably large library, and it would really help if I could plot dependencies between modules, and which modues make use of which external crates. Is there anthing that can do that? Graphviz dot files would be fine.
I suspect it's part of the AST with some paths collapsed? Or am I completely wrong?
It sounds like you're looking for something along the lines of cargo-graph, except instead of graphing how different crates depend on each other, you're looking at the individual components inside the crate.
I'm not sure if there are any tools out there which can do something like that just yet, although one of the debug flags for rustc may have what you want.
After running rustc -Z help I noticed this debug flag:
-Z dump-dep-graph -- dump the dependency graph to $RUST_DEP_GRAPH (default: /tmp/dep_graph.gv)
Just out of interest I tried this out on a fairly trivial project.
Scrap that - with unstable it works, sort of. I stopped the process with SIGINT when the svg size got above 100MB. Maybe it does it for all dependencies as well, which is not what I want. I might see how the crate one works and see if it's possible to mod the code.
I know you're looking for some kind of visual way of exploring the library here, but when I'm trying to wrap my head around a new library the first thing I do is open up the docs with cargo doc --open.
It doesn't give you a nice pretty graph like graphviz would, but by clicking through the various modules and types or seeing what struct is returned by which function usually helps to give you a nice overview of how the crate is laid out.
Thanks for the replies. If a library is well written I would also recommend docs and cargo modules. My reason for needing this tool is a confusingly laid out library with poor documentation.