Struct wee_rl::Editor
[−]
[src]
pub struct Editor<C: Completer> { /* fields omitted */ }
Line editor
Methods
impl<C: Completer> Editor<C>
[src]
fn new() -> Editor<C>
[src]
fn with_config(config: Config) -> Editor<C>
[src]
fn readline(&mut self, prompt: &str) -> Result<String>
[src]
This method will read a line from STDIN and will display a prompt
fn load_history<P: AsRef<Path> + ?Sized>(&mut self, path: &P) -> Result<()>
[src]
Load the history from the specified file.
fn save_history<P: AsRef<Path> + ?Sized>(&self, path: &P) -> Result<()>
[src]
Save the history in the specified file.
fn add_history_entry<S: AsRef<str> + Into<String>>(&mut self, line: S) -> bool
[src]
Add a new entry in the history.
fn clear_history(&mut self)
[src]
Clear history.
fn get_history(&mut self) -> &mut History
[src]
Return a mutable reference to the history object.
fn get_history_const(&self) -> &History
[src]
Return an immutable reference to the history object.
fn set_completer(&mut self, completer: Option<C>)
[src]
Register a callback function to be called for tab-completion.
fn bind_sequence(&mut self, key_seq: KeyPress, cmd: Cmd) -> Option<Cmd>
[src]
Bind a sequence to a command.
fn unbind_sequence(&mut self, key_seq: KeyPress) -> Option<Cmd>
[src]
Remove a binding for the given sequence.
fn iter<'a>(&'a mut self, prompt: &'a str) -> Iter<C>
[src]
let mut rl = wee_rl::Editor::<()>::new(); for readline in rl.iter("> ") { match readline { Ok(line) => { println!("Line: {}", line); }, Err(err) => { println!("Error: {:?}", err); break } } }