{
  "slug": "rust-module-map",
  "name": "gizza-ai/rust-module-map",
  "version": "0.1.0",
  "title": "Rust Module Map — Source to Tree, Mermaid, JSON or Paths — gizza.ai",
  "description": "Paste Rust source and map its modules, structs, enums, traits, impl blocks, functions and visibility as a tree, Mermaid graph, JSON, or crate::path list.",
  "tags": [
    "rust module map",
    "rust source tree",
    "rust ast viewer",
    "rust mermaid graph",
    "rust code outline",
    "cargo modules",
    "rust visibility",
    "rust impl methods",
    "rust module hierarchy"
  ],
  "category": "utilities",
  "urls": {
    "page": "https://gizza.ai/tools/rust-module-map/",
    "markdown": "https://gizza.ai/tools/rust-module-map/index.md",
    "descriptor": "https://gizza.ai/tools/rust-module-map/tool.json",
    "deep_link_example": "https://gizza.ai/tools/rust-module-map/?source=pub%20mod%20config%20%7B%0A%20%20%20%20pub%20struct%20Config%3B%0A%20%20%20%20impl%20Config%20%7B%20pub%20fn%20load%28%29%20-%3E%20Self%20%7B%20Config%20%7D%20%7D%0A%7D%0A%0Afn%20main%28%29%20%7B%7D&format=tree&max_depth=0&focus_on=crate%3A%3Aconfig&sort_by=source&show_types=true&show_traits=true&show_fns=true&show_impls=true&show_consts=true&include_tests=true&show_visibility=true&crate_name=my_crate"
  },
  "cli": "gizza tool rust-module-map \"pub mod config {\n    pub struct Config;\n    impl Config { pub fn load() -> Self { Config } }\n}\n\nfn main() {}\"",
  "tool": {
    "description": "Parse pasted Rust source with syn and render the module/item hierarchy as an indented tree, Mermaid flowchart, JSON tree, or flat crate::path list. Supports nested inline modules, 'mod foo;' declarations resolved from multi-file pastes with '=== src/foo.rs ===' headers, visibility annotations, impl methods, optional test items, kind filters, sorting, max-depth truncation, and focusing on a module path. It does not run cargo metadata or resolve cfg/features from disk; it maps exactly the Rust text you paste.",
    "parameters": {
      "additionalProperties": false,
      "properties": {
        "crate_name": {
          "default": "",
          "description": "Optional label for the crate root. Empty (default) renders the root as 'crate'; set this to your package name for prettier paths/graphs.",
          "type": "string"
        },
        "focus_on": {
          "default": "",
          "description": "Optional module path to render instead of the whole crate, e.g. 'crate::config' or 'config::loader'. Empty (default) renders the whole pasted source.",
          "type": "string"
        },
        "format": {
          "default": "tree",
          "description": "Output shape: 'tree' for an indented module/item tree, 'mermaid' for a Mermaid flowchart, 'json' for a structured tree with counts, or 'paths' for a flat crate::module::Item list.",
          "enum": [
            "tree",
            "mermaid",
            "json",
            "paths"
          ],
          "type": "string"
        },
        "include_tests": {
          "default": false,
          "description": "Include #[cfg(test)] modules and #[test]/#[bench] functions. Default false, matching normal cargo-modules output.",
          "type": "boolean"
        },
        "max_depth": {
          "default": 0,
          "description": "Maximum depth below the crate root to render. 0 (default) means unlimited; 1 shows only top-level items; max 64.",
          "maximum": 64,
          "minimum": 0,
          "type": "integer"
        },
        "show_consts": {
          "default": false,
          "description": "Include const and static items. Default false to keep large modules focused on structure.",
          "type": "boolean"
        },
        "show_fns": {
          "default": true,
          "description": "Include free functions and methods inside impl blocks. Default true.",
          "type": "boolean"
        },
        "show_impls": {
          "default": true,
          "description": "Include impl blocks and their associated items. Default true.",
          "type": "boolean"
        },
        "show_traits": {
          "default": true,
          "description": "Include trait and trait-alias declarations. Default true.",
          "type": "boolean"
        },
        "show_types": {
          "default": true,
          "description": "Include type declarations: structs, enums, unions and type aliases. Default true.",
          "type": "boolean"
        },
        "show_visibility": {
          "default": true,
          "description": "Annotate each item with visibility such as pub, pub(crate), pub(super), pub(in path), or pub(self). Default true.",
          "type": "boolean"
        },
        "sort_by": {
          "default": "source",
          "description": "Sibling ordering. 'source' preserves declaration order; 'name' sorts alphabetically; 'kind' groups modules/types/functions; 'visibility' puts public items first.",
          "enum": [
            "source",
            "name",
            "kind",
            "visibility"
          ],
          "type": "string"
        },
        "source": {
          "description": "Rust source to map. Paste a lib.rs/main.rs/module file, or paste multiple files separated by header lines like '=== src/lib.rs ===' and '=== src/foo.rs ==='. Max 512 KiB.",
          "type": "string"
        }
      },
      "required": [
        "source"
      ],
      "type": "object"
    }
  }
}