cargo-graph icon indicating copy to clipboard operation
cargo-graph copied to clipboard

module graphs?

Open flying-sheep opened this issue 10 years ago • 4 comments

hi! i wanted to ask if module dependencies within a crate are out of scope or could be implemented.

surely a bigger thing as we’d have to parse rust…

the utility would be detecting dependency cycles and therefore get help with better module structure.

flying-sheep avatar Nov 14 '15 21:11 flying-sheep

Parsing local modules probably wouldn't be too difficult, but parsing external modules (to include std) would be much more difficult and require the source.

I'll play with some ideas and see what I can figure out.

kbknapp avatar Nov 15 '15 08:11 kbknapp

Having the ability to graph just local module dependencies would help review designs a lot.

nixpulvis avatar Apr 22 '16 12:04 nixpulvis

I like this idea. And as far as I'm concerned, graphing only local dependencies would actually be better than graphing global modules too. I actually wrote my own version of this tool, but it uses awk and sh, so it's far from perfect. In particular, it doesn't work at all with nested import groups.

asomers avatar Jun 15 '18 23:06 asomers

Here's a newer crate than produces nice module graphs: https://github.com/regexident/cargo-modules

asomers avatar Jun 16 '18 00:06 asomers