Skip to main content

rename_item

Function rename_item 

Source
pub fn rename_item(
    workload_path: &Path,
    old_name: &str,
    new_name: &str,
    replace: bool,
) -> Result<()>
Expand description

Rename a report item from old_name to new_name in the workload at workload_path. SRD-64 §6.6: pure metadata edit — anchor stays at the existing site.

replace controls collision policy:

  • false — error if new_name is already in use anywhere in the workload.
  • true — destructive overwrite: drop the existing item at new_name and rename old_name over it. Mutually exclusive with the existing-name path: a destructive rename leaves the workload with one item under new_name, holding the spec from old_name.

The collision-target item being a different kind from old_name is allowed — --replace is the user’s affirmation that they want the destructive swap regardless.