Function chalk::readline_loop

source ·
pub(crate) fn readline_loop<F>(
    rl: &mut DefaultEditor,
    prompt: &str,
    f: F
) -> Result<(), Box<dyn Error>>
where F: FnMut(&mut DefaultEditor, &str),
Expand description

Reads input lines from the user. Lines start with the string given by prompt. Each line the user enters is passed to the function f for processing.

The loop terminates (and the program ends) when EOF is reached or if an error occurs while reading the next line.