Skip to main content

Module cargo_parser

Module cargo_parser 

Source
Expand description

Parse Cargo.toml manifests into CrateManifest structs.

Handles:

  • [package] metadata (name, version, description, edition)
  • [dependencies], [dev-dependencies], [build-dependencies]
  • Workspace inheritance: version.workspace = true resolved from workspace root
  • Dependency sources: workspace, path, git, crates.io
  • Inline table form: dep = "1.0" and table form: dep = { version = "1.0" }

§Example

use nusy_codegraph::cargo_parser::CrateManifest;
use std::path::Path;

let manifest = CrateManifest::from_path(Path::new("Cargo.toml")).unwrap();
println!("{} {}", manifest.name, manifest.version);

Structs§

CrateDependency
A single dependency entry parsed from a Cargo.toml dependency table.
CrateManifest
A parsed Cargo.toml manifest.

Enums§

DependencySource
Provenance of a dependency.

Functions§

parse_workspace_dependencies
Parse the workspace root Cargo.toml and return a map of name → version for all entries under [workspace.dependencies].