Struct rustyline::Editor [−][src]
pub struct Editor<H: Helper> { /* fields omitted */ }
Expand description
Line editor
Implementations
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.
Add a new entry in the history.
Clear history.
Return a mutable 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.
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;
}
}
}
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