Function copy_and_replace_cstring_placeholder

Source
pub fn copy_and_replace_cstring_placeholder(
    source_bytes: &[u8],
    destination: impl Write,
    prefix_placeholder: &str,
    target_prefix: &str,
) -> Result<(), Error>
Expand description

Given the contents of a file, copies it to the destination and in the process replace any binary c-style string that contains the text prefix_placeholder with a binary compatible c-string where the prefix_placeholder text is replaced with the target_prefix text.

The length of the input will match the output.

This function replaces binary c-style strings. If you want to simply find-and-replace text in a file instead use the copy_and_replace_textual_placeholder function.