Struct datafusion_rustyline::Editor [−][src]
pub struct Editor<H: Helper> { /* fields omitted */ }
Line editor
Methods
impl<H: Helper> Editor<H>
[src]
impl<H: Helper> Editor<H>
pub fn new() -> Editor<H>
[src]
pub fn new() -> Editor<H>
Create an editor with the default configuration
pub fn with_config(config: Config) -> Editor<H>
[src]
pub fn with_config(config: Config) -> Editor<H>
Create an editor with a specific configuration.
pub fn readline(&mut self, prompt: &str) -> Result<String>
[src]
pub fn readline(&mut self, prompt: &str) -> Result<String>
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.
pub fn readline_with_initial(
&mut self,
prompt: &str,
initial: (&str, &str)
) -> Result<String>
[src]
pub fn readline_with_initial(
&mut self,
prompt: &str,
initial: (&str, &str)
) -> Result<String>
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.
pub fn load_history<P: AsRef<Path> + ?Sized>(&mut self, path: &P) -> Result<()>
[src]
pub fn load_history<P: AsRef<Path> + ?Sized>(&mut self, path: &P) -> Result<()>
Load the history from the specified file.
pub fn save_history<P: AsRef<Path> + ?Sized>(&self, path: &P) -> Result<()>
[src]
pub fn save_history<P: AsRef<Path> + ?Sized>(&self, path: &P) -> Result<()>
Save the history in the specified file.
pub fn add_history_entry<S: AsRef<str> + Into<String>>(
&mut self,
line: S
) -> bool
[src]
pub fn add_history_entry<S: AsRef<str> + Into<String>>(
&mut self,
line: S
) -> bool
Add a new entry in the history.
pub fn clear_history(&mut self)
[src]
pub fn clear_history(&mut self)
Clear history.
pub fn get_history(&mut self) -> &mut History
[src]
pub fn get_history(&mut self) -> &mut History
Return a mutable reference to the history object.
pub fn get_history_const(&self) -> &History
[src]
pub fn get_history_const(&self) -> &History
Return an immutable reference to the history object.
pub fn set_helper(&mut self, helper: Option<H>)
[src]
pub fn set_helper(&mut self, helper: Option<H>)
Register a callback function to be called for tab-completion or to show hints to the user at the right of the prompt.
pub fn set_completer(&mut self, completer: Option<H>)
[src]
pub fn set_completer(&mut self, completer: Option<H>)
: Use set_helper instead
pub fn bind_sequence(&mut self, key_seq: KeyPress, cmd: Cmd) -> Option<Cmd>
[src]
pub fn bind_sequence(&mut self, key_seq: KeyPress, cmd: Cmd) -> Option<Cmd>
Bind a sequence to a command.
pub fn unbind_sequence(&mut self, key_seq: KeyPress) -> Option<Cmd>
[src]
pub fn unbind_sequence(&mut self, key_seq: KeyPress) -> Option<Cmd>
Remove a binding for the given sequence.
ⓘImportant traits for Iter<'a, H>pub fn iter<'a>(&'a mut self, prompt: &'a str) -> Iter<H>
[src]
pub fn iter<'a>(&'a mut self, prompt: &'a str) -> Iter<H>
let mut rl = rustyline::Editor::<()>::new(); for readline in rl.iter("> ") { match readline { Ok(line) => { println!("Line: {}", line); } Err(err) => { println!("Error: {:?}", err); break; } } }