Struct rustyline::Editor[][src]

pub struct Editor<H: Helper> { /* fields omitted */ }
Expand description

Line editor

Implementations

Create an editor with the default configuration

Create an editor with a specific configuration.

This method will read a line from STDIN and will display a prompt.

It uses terminal-style interaction if stdin is connected to a terminal. Otherwise (e.g., if stdin is a pipe or the terminal is not supported), it uses file-style interaction.

This function behaves in the exact same manner as readline, except that it pre-populates the input area.

The text that resides in the input area is given as a 2-tuple. The string on the left of the tuple is what will appear to the left of the cursor and the string on the right is what will appear to the right of the cursor.

Load the history from the specified file.

Save the history in the specified file.

Append new entries in the specified file.

pub fn add_history_entry<S: AsRef<str> + Into<String>>(
    &mut self,
    line: S
) -> bool

Add a new entry in the history.

Clear history.

Return a mutable reference to the history object.

Return an immutable reference to the history object.

Register a callback function to be called for tab-completion or to show hints to the user at the right of the prompt.

Return a mutable reference to the helper.

Return an immutable reference to the helper.

Bind a sequence to a command.

Remove a binding for the given sequence.

Returns an iterator over edited lines

let mut rl = rustyline::Editor::<()>::new();
for readline in rl.iter("> ") {
    match readline {
        Ok(line) => {
            println!("Line: {}", line);
        }
        Err(err) => {
            println!("Error: {:?}", err);
            break;
        }
    }
}

If output stream is a tty, this function returns its width and height as a number of characters.

Trait Implementations

Config accessor.

Set the maximum length for the history.

Tell if lines which match the previous history entry are saved or not in the history list. Read more

Tell if lines which begin with a space character are saved or not in the history list. Read more

Forces colorization on or off. Read more

Set completion_type.

The number of possible completions that determines when the user is asked whether the list of possibilities should be displayed. Read more

Timeout for ambiguous key sequences in milliseconds.

Choose between Emacs or Vi mode.

Tell if lines are automatically added to the history. Read more

Set bell style: beep, flash or nothing.

Whether to use stdout or stderr Read more

Horizontal space taken by a tab. Read more

Check if cursor position is at leftmost before displaying prompt. Read more

Indentation size for indent/dedent commands Read more

Enable or disable bracketed paste on unix platform Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.