pub struct CrateManifest {
pub name: String,
pub version: String,
pub description: Option<String>,
pub edition: String,
pub dependencies: Vec<CrateDependency>,
pub dev_dependencies: Vec<CrateDependency>,
pub build_dependencies: Vec<CrateDependency>,
pub workspace_member: bool,
}Expand description
A parsed Cargo.toml manifest.
Fields§
§name: StringCrate name from [package].name
version: StringResolved version string (workspace inheritance resolved)
description: Option<String>Optional description from [package].description
edition: StringEdition, e.g. "2024" (defaults to "2021" if missing)
dependencies: Vec<CrateDependency>Runtime dependencies from [dependencies]
dev_dependencies: Vec<CrateDependency>Dev-only dependencies from [dev-dependencies]
build_dependencies: Vec<CrateDependency>Build-script dependencies from [build-dependencies]
workspace_member: boolTrue when the crate is listed in [workspace].members
Implementations§
Source§impl CrateManifest
impl CrateManifest
Sourcepub fn from_path(cargo_toml: &Path) -> Result<Self, String>
pub fn from_path(cargo_toml: &Path) -> Result<Self, String>
Parse a single Cargo.toml at cargo_toml.
If the package version uses workspace inheritance (version.workspace = true),
we look for the workspace root at ../../../Cargo.toml (three levels up from
crates/<name>/Cargo.toml). The caller can supply pre-parsed workspace deps
by calling CrateManifest::from_path_with_workspace directly.
Sourcepub fn from_path_with_workspace(
cargo_toml: &Path,
workspace_deps: &HashMap<String, String>,
workspace_member: bool,
) -> Result<Self, String>
pub fn from_path_with_workspace( cargo_toml: &Path, workspace_deps: &HashMap<String, String>, workspace_member: bool, ) -> Result<Self, String>
Parse a Cargo.toml with an explicit pre-parsed workspace dependency map.
workspace_member is set to the supplied value (the workspace root parser sets
this after checking [workspace].members).
Sourcepub fn all_dependencies(&self) -> impl Iterator<Item = &CrateDependency>
pub fn all_dependencies(&self) -> impl Iterator<Item = &CrateDependency>
All dependencies (runtime + dev + build) as a flat iterator.
Trait Implementations§
Source§impl Clone for CrateManifest
impl Clone for CrateManifest
Source§fn clone(&self) -> CrateManifest
fn clone(&self) -> CrateManifest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more