debian_analyzer::editor

Function edit_formatted_file

Source
pub fn edit_formatted_file(
    path: &Path,
    original_contents: Option<&[u8]>,
    rewritten_contents: Option<&[u8]>,
    updated_contents: Option<&[u8]>,
    allow_generated: bool,
    allow_reformatting: bool,
) -> Result<bool, EditorError>
Expand description

Edit a formatted file.

§Arguments

  • path - Path to the file
  • original_contents - The original contents of the file
  • rewritten_contents - The contents rewritten with our parser/serializer
  • updated_contents - Updated contents rewritten with our parser/serializer after changes were made
  • allow_generated - Do not raise GeneratedFile when encountering a generated file
  • allow_reformatting - Whether to allow reformatting of the file

§Returns

true if the file was changed, false otherwise