pub async fn execute_sync(manifest_path: &str) -> Result<SyncReport, SyncError>Expand description
Align every local path entry under [workspace.dependencies] with the
workspace root version, and (optionally) the dep alias with the member
crate’s actual [package].name.
§Arguments
&str: Path to the workspace root Cargo.toml.
§Returns
Result<SyncReport, SyncError>: Summary of what was rewritten.
§Behavior
- Reads the root version via
read_root_version(workspace package version first, plain package version as fallback). Errors out if neither exists. - Reads
[workspace.members]. Errors out if it is missing. - When the root manifest also has
[package](monorepo with a root package), the root package itself is processed first as member path".", so apath = "."entry stays aligned too. - For each member path:
- Opens
<member_path>/Cargo.tomland reads its[package].name. - Locates the existing
[workspace.dependencies]entry whosepath = \"<member_path>\"and captures its current LHS alias. - If the entry is already aligned (alias + version both correct), skip it.
- Otherwise rewrite the entry in-place: align
versionto the root version, and rename the LHS alias to match the crate’s[package].namewhen the alias differs.
- Opens
- Edits are applied on a
toml_edit::DocumentMut, so comments, key order and inline-table formatting outside the edited values are preserved byte-for-byte. file_changedis true iff at least one rename or version-rewrite actually happened (so a no-op run is genuinely idempotent and does not write the file).