[][src]Function edit::edit

pub fn edit<S: AsRef<[u8]>>(text: S) -> Result<String>

Open the contents of a string or buffer in the default editor.

This function saves its input to a temporary file and 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.

Arguments

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 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.