cargo::ops::cargo_new

Function update_manifest_with_new_member

source
fn update_manifest_with_new_member(
    root_manifest_path: &Path,
    workspace_document: &mut DocumentMut,
    display_path: &str,
) -> CargoResult<bool>
Expand description

Adds the new package member to the [workspace.members] array.

  • It first checks if the name matches any element in [workspace.exclude], and it ignores the name if there is a match.
  • Then it check if the name matches any element already in [workspace.members], and it ignores the name if there is a match.
  • If [workspace.members] doesn’t exist in the manifest, it will add a new section with the new package in it.