Struct rustyline::Editor [−][src]
pub struct Editor<H: Helper> { /* fields omitted */ }
Expand description
Line editor
Implementations
impl<H: Helper> Editor<H>
[src]
impl<H: Helper> Editor<H>
[src]pub fn with_config(config: Config) -> Self
[src]
pub fn with_config(config: Config) -> Self
[src]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>
[src]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>
[src]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<()>
[src]Load the history from the specified file.
pub fn save_history<P: AsRef<Path> + ?Sized>(&mut self, path: &P) -> Result<()>
[src]
pub fn save_history<P: AsRef<Path> + ?Sized>(&mut self, path: &P) -> Result<()>
[src]Save the history in the specified file.
pub fn append_history<P: AsRef<Path> + ?Sized>(
&mut self,
path: &P
) -> Result<()>
[src]
pub fn append_history<P: AsRef<Path> + ?Sized>(
&mut self,
path: &P
) -> Result<()>
[src]Append new entries 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
[src]Add a new entry in the history.
pub fn clear_history(&mut self)
[src]
pub fn clear_history(&mut self)
[src]Clear history.
pub fn history_mut(&mut self) -> &mut History
[src]
pub fn history_mut(&mut self) -> &mut History
[src]Return a mutable reference to the history object.
pub fn set_helper(&mut self, helper: Option<H>)
[src]
pub fn set_helper(&mut self, helper: Option<H>)
[src]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 helper_mut(&mut self) -> Option<&mut H>
[src]
pub fn helper_mut(&mut self) -> Option<&mut H>
[src]Return a mutable reference to the helper.
pub fn bind_sequence<E: Into<Event>, R: Into<EventHandler>>(
&mut self,
key_seq: E,
handler: R
) -> Option<EventHandler>
[src]
pub fn bind_sequence<E: Into<Event>, R: Into<EventHandler>>(
&mut self,
key_seq: E,
handler: R
) -> Option<EventHandler>
[src]Bind a sequence to a command.
pub fn unbind_sequence<E: Into<Event>>(
&mut self,
key_seq: E
) -> Option<EventHandler>
[src]
pub fn unbind_sequence<E: Into<Event>>(
&mut self,
key_seq: E
) -> Option<EventHandler>
[src]Remove a binding for the given sequence.
pub fn iter<'a>(
&'a mut self,
prompt: &'a str
) -> impl Iterator<Item = Result<String>> + 'a
[src]
pub fn iter<'a>(
&'a mut self,
prompt: &'a str
) -> impl Iterator<Item = Result<String>> + 'a
[src]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
impl<H: Helper> Configurer for Editor<H>
[src]
impl<H: Helper> Configurer for Editor<H>
[src]fn config_mut(&mut self) -> &mut Config
[src]
fn config_mut(&mut self) -> &mut Config
[src]Config
accessor.
fn set_max_history_size(&mut self, max_size: usize)
[src]
fn set_max_history_size(&mut self, max_size: usize)
[src]Set the maximum length for the history.
fn set_history_ignore_dups(&mut self, yes: bool)
[src]
fn set_history_ignore_dups(&mut self, yes: bool)
[src]Tell if lines which match the previous history entry are saved or not in the history list. Read more
fn set_history_ignore_space(&mut self, yes: bool)
[src]
fn set_history_ignore_space(&mut self, yes: bool)
[src]Tell if lines which begin with a space character are saved or not in the history list. Read more
fn set_color_mode(&mut self, color_mode: ColorMode)
[src]
fn set_color_mode(&mut self, color_mode: ColorMode)
[src]Forces colorization on or off. Read more
fn set_completion_type(&mut self, completion_type: CompletionType)
[src]
fn set_completion_type(&mut self, completion_type: CompletionType)
[src]Set completion_type
.
fn set_completion_prompt_limit(&mut self, completion_prompt_limit: usize)
[src]
fn set_completion_prompt_limit(&mut self, completion_prompt_limit: usize)
[src]The number of possible completions that determines when the user is asked whether the list of possibilities should be displayed. Read more
fn set_keyseq_timeout(&mut self, keyseq_timeout_ms: i32)
[src]
fn set_keyseq_timeout(&mut self, keyseq_timeout_ms: i32)
[src]Timeout for ambiguous key sequences in milliseconds.
fn set_edit_mode(&mut self, edit_mode: EditMode)
[src]
fn set_edit_mode(&mut self, edit_mode: EditMode)
[src]Choose between Emacs or Vi mode.
fn set_auto_add_history(&mut self, yes: bool)
[src]
fn set_auto_add_history(&mut self, yes: bool)
[src]Tell if lines are automatically added to the history. Read more
fn set_bell_style(&mut self, bell_style: BellStyle)
[src]
fn set_bell_style(&mut self, bell_style: BellStyle)
[src]Set bell style: beep, flash or nothing.
fn set_output_stream(&mut self, stream: OutputStreamType)
[src]
fn set_output_stream(&mut self, stream: OutputStreamType)
[src]Whether to use stdout or stderr Read more
fn set_tab_stop(&mut self, tab_stop: usize)
[src]
fn set_tab_stop(&mut self, tab_stop: usize)
[src]Horizontal space taken by a tab. Read more
fn set_check_cursor_position(&mut self, yes: bool)
[src]
fn set_check_cursor_position(&mut self, yes: bool)
[src]Check if cursor position is at leftmost before displaying prompt. Read more
fn set_indent_size(&mut self, size: usize)
[src]
fn set_indent_size(&mut self, size: usize)
[src]Indentation size for indent/dedent commands Read more
fn enable_bracketed_paste(&mut self, enabled: bool)
[src]
fn enable_bracketed_paste(&mut self, enabled: bool)
[src]Enable or disable bracketed paste on unix platform Read more
Auto Trait Implementations
impl<H> RefUnwindSafe for Editor<H> where
H: RefUnwindSafe,
H: RefUnwindSafe,
impl<H> Send for Editor<H> where
H: Send,
H: Send,
impl<H> Sync for Editor<H> where
H: Sync,
H: Sync,
impl<H> Unpin for Editor<H> where
H: Unpin,
H: Unpin,
impl<H> UnwindSafe for Editor<H> where
H: UnwindSafe,
H: UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T