Skip to content

Commit

Permalink
docs(toml): Clarify what resolving a TOML means
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Apr 26, 2024
1 parent c43d732 commit dc4389f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/cargo/core/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ impl Manifest {
pub fn contents(&self) -> &str {
self.contents.as_str()
}
/// See [`Manifest::resolved_toml`] for what "resolved" means
pub fn to_resolved_contents(&self) -> CargoResult<String> {
let toml = toml::to_string_pretty(self.resolved_toml())?;
Ok(format!("{}\n{}", MANIFEST_PREAMBLE, toml))
Expand All @@ -496,6 +497,11 @@ impl Manifest {
&self.original_toml
}
/// The [`TomlManifest`] with all fields expanded
///
/// This is the intersection of what fields need resolving for cargo-publish that also are
/// useful for the operation of cargo, including
/// - workspace inheritance
/// - target discovery
pub fn resolved_toml(&self) -> &TomlManifest {
&self.resolved_toml
}
Expand Down
1 change: 1 addition & 0 deletions src/cargo/util/toml/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ fn to_workspace_root_config(
ws_root_config
}

/// See [`Manifest::resolved_toml`] for more details
#[tracing::instrument(skip_all)]
fn resolve_toml(
original_toml: &manifest::TomlManifest,
Expand Down

0 comments on commit dc4389f

Please sign in to comment.