regexident / cargo-modules

Visualize/analyze a Rust crate's internal structure

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature: Add module grouping/Reflection model

hmvp opened this issue · comments

commented

Based on http://www.pathsensitive.com/2021/03/developer-tools-can-be-magic-instead.html
The first part speaks about reflection models. It seems to me that should be something powerful but easy to add to cargo modules:

It is starts as basically an option to point to a file with a mapping between modules (files in the original tool, but I suspect modules work better in rust context) and self defined categories. And instead of drawing the modules as nodes for the usage/dependency graph you use the categories and aggregate what is in de modules grouped by that category..

To implement the full model you could also add stuff to draw the graph into an existing dot graph which could contain the hypothesis graph (that should roughly work if the node ids match). However that might not even be needed to make it useful

From what I understood from the article the reflexion mode would effectively allow you to collapse a selection of nodes (i.e. a subgraph) into a new node (i.e. a meta-node)? A bit like the meta-node functionality you find in pretty much any node-graph editor out there (shader graphs, quartz composer, etc.).

In that case we already have a somewhat hack-ish implementation of such feature in order to collapse individual external imports into single "extern crate" nodes per extern crate. Might be a good time to improve the implementation and make it more robust. 🤔

commented

From what I understood from the article the reflexion mode would effectively allow you to collapse a selection of nodes (i.e. a subgraph) into a new node (i.e. a meta-node)? A bit like the meta-node functionality you find in pretty much any node-graph editor out there (shader graphs, quartz composer, etc.).

Yes exactly and it should be guided by a mapping the user can give.

The second part of the described reflection model tool allows you to make a graph yourself and kind of superimpose that over the generated graph to see if your hypothesis matches the real world. Although I am not sure if that is critically needed. It seems to me that just "cleaning up" the real graph is the most important bit.. The other part can be done mentally as well..