regexident / cargo-modules

Visualize/analyze a Rust crate's internal structure
Mozilla Public License 2.0
988 stars 48 forks source link

Add `--no-owns` CLI flag for `dependencies` command #348

Open regexident opened 1 week ago

regexident commented 1 week ago

This option filters out structural edges, as well as any nodes with a degree of 0 (i.e. disconnected nodes).

Fixes https://github.com/regexident/cargo-modules/issues/274


Without --no-owns

cargo run --release -- dependencies --manifest-path "tests/projects/smoke"  > ./graph-without-owns.dot

smoke-with-owns-edges

With --no-owns

cargo run --release -- dependencies --manifest-path "tests/projects/smoke" -
-no-owns > ./graph-without-owns.dot

smoke-without-owns-edges

wduminy commented 2 days ago

I think this feature works well. I attached the two images below.

Notice some blocks does not show in the second image which helps to create the view I wanted. Thanks!

Args to produce image:

cargo-modules dependencies -p rc-bot --no-externs --no-owns --no-types --no-traits --no-fns | dot -Tsvg -ono-owns.svg

With owns: image

Without owns image

regexident commented 2 days ago

I think this feature works well.

Cool! I guess I'll leave this open until next week's release (Tuesday/Wednesday-ish) then and merge it if no major concerns with the implementations have come up by then.