pub fn edit_with_builder<S: AsRef<[u8]>>(
    text: S,
    builder: &Builder<'_, '_>
) -> Result<String>
Expand description

Open the contents of a string or buffer in the default editor using a temporary file with a custom path or filename.

This function saves its input to a temporary file created using builder, then opens the default editor to it. It waits for the editor to return, re-reads the (possibly changed/edited) temporary file, and then deletes it.

Other than the custom Builder, this function is identical to edit.

Arguments

builder is used to create a temporary file, potentially with a custom name, path, or prefix.

text is written to the temporary file before invoking the editor. (The editor opens with the contents of text already in the file).

Returns

If successful, returns the edited string. If the temporary file can’t be created with the provided builder, may return any error returned by OpenOptions::open. If the edited version of the file can’t be decoded as UTF-8, returns ErrorKind::InvalidData. If no text editor could be found, returns ErrorKind::NotFound. Any errors related to spawning the editor process will also be passed through.