Skip to main content

execute_sync

Function execute_sync 

Source
pub async fn execute_sync(manifest_path: &str) -> Result<SyncReport, SyncError>
Expand description

Align every local path-only entry under [workspace.dependencies] with the workspace 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 [workspace.package].version. Errors out if it is missing.
  • Reads [workspace.members]. Errors out if it is missing.
  • For each member path:
    1. Opens <member_path>/Cargo.toml and reads its [package].name.
    2. Locates the existing [workspace.dependencies] entry whose path = "<member_path>" and captures its current LHS alias.
    3. If the entry is already aligned (alias + version both correct), skip it.
    4. Otherwise rewrite the entry: align version to the workspace version, and rename the LHS alias to match the crate’s [package].name when the alias differs.
  • file_changed is 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).