Function edit_in_editor

Source
pub fn edit_in_editor(string: &str) -> Result<String, OpenEditorError>
Expand description

Open the default editor and allows editing of a string.

The default editor is determined by the VISUAL and EDITOR environment variables, in that order.

ยงErrors

This function will return an error if the editor call fails, if the file cannot be read, or if the temporary file cleanup fails.

Examples found in repository?
examples/fill_template.rs (line 5)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4    let template = "Hello, {name}!\nWelcome to {place}.";
5    let filled_template = edit_in_editor(template)?;
6    println!("Filled Template:\n{filled_template}");
7    Ok(())
8}