[−][src]Struct rustyline::Editor
Line editor
Implementations
impl<H: Helper> Editor<H>
[src]
pub fn new() -> Self
[src]
Create an editor with the default configuration
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]
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]
&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]
Load the history from the specified file.
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]
&mut self,
path: &P
) -> Result<()>
Append new entries in the specified file.
pub fn add_history_entry<S: AsRef<str> + Into<String>>(
&mut self,
line: S
) -> bool
[src]
&mut self,
line: S
) -> bool
Add a new entry in the history.
pub fn clear_history(&mut self)
[src]
Clear history.
pub fn history_mut(&mut self) -> &mut History
[src]
Return a mutable reference to the history object.
pub fn history(&self) -> &History
[src]
Return an immutable reference to the history object.
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]
Return a mutable reference to the helper.
pub fn helper(&self) -> Option<&H>
[src]
Return an immutable reference to the helper.
pub fn bind_sequence(&mut self, key_seq: KeyEvent, cmd: Cmd) -> Option<Cmd>
[src]
Bind a sequence to a command.
pub fn unbind_sequence(&mut self, key_seq: KeyEvent) -> Option<Cmd>
[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]
&'a mut self,
prompt: &'a str
) -> impl Iterator<Item = Result<String>> + 'a
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; } } }
pub fn dimensions(&mut self) -> Option<(usize, usize)>
[src]
If output stream is a tty, this function returns its width and height as a number of characters.
Trait Implementations
impl<H: Helper> Configurer for Editor<H>
[src]
pub fn config_mut(&mut self) -> &mut Config
[src]
pub fn set_max_history_size(&mut self, max_size: usize)
[src]
pub fn set_history_ignore_dups(&mut self, yes: bool)
[src]
pub fn set_history_ignore_space(&mut self, yes: bool)
[src]
pub fn set_color_mode(&mut self, color_mode: ColorMode)
[src]
pub fn set_completion_type(&mut self, completion_type: CompletionType)
[src]
pub fn set_completion_prompt_limit(&mut self, completion_prompt_limit: usize)
[src]
pub fn set_keyseq_timeout(&mut self, keyseq_timeout_ms: i32)
[src]
pub fn set_edit_mode(&mut self, edit_mode: EditMode)
[src]
pub fn set_auto_add_history(&mut self, yes: bool)
[src]
pub fn set_bell_style(&mut self, bell_style: BellStyle)
[src]
pub fn set_output_stream(&mut self, stream: OutputStreamType)
[src]
pub fn set_tab_stop(&mut self, tab_stop: usize)
[src]
pub fn set_check_cursor_position(&mut self, yes: bool)
[src]
pub fn set_indent_size(&mut self, size: usize)
[src]
impl<H: Helper> Debug for Editor<H>
[src]
Auto Trait Implementations
impl<H> RefUnwindSafe for Editor<H> where
H: RefUnwindSafe,
[src]
H: RefUnwindSafe,
impl<H> Send for Editor<H> where
H: Send,
[src]
H: Send,
impl<H> Sync for Editor<H> where
H: Sync,
[src]
H: Sync,
impl<H> Unpin for Editor<H> where
H: Unpin,
[src]
H: Unpin,
impl<H> UnwindSafe for Editor<H> where
H: UnwindSafe,
[src]
H: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,