Struct rustyline::Editor
[−]
[src]
pub struct Editor<C: Completer> { /* fields omitted */ }
Line editor
Methods
impl<C: Completer> Editor<C>
[src]
fn new() -> Editor<C>
fn with_config(config: Config) -> Editor<C>
fn readline(&mut self, prompt: &str) -> Result<String>
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<()>
Load the history from the specified file.
fn save_history<P: AsRef<Path> + ?Sized>(&self, path: &P) -> Result<()>
Save the history in the specified file.
fn add_history_entry<S: AsRef<str> + Into<String>>(&mut self, line: S) -> bool
Add a new entry in the history.
fn clear_history(&mut self)
Clear history.
fn get_history(&mut self) -> &mut History
Return a reference to the history object.
fn set_completer(&mut self, completer: Option<C>)
Register a callback function to be called for tab-completion.
fn iter<'a>(&'a mut self, prompt: &'a str) -> Iter<C>
let mut rl = rustyline::Editor::<()>::new(); for readline in rl.iter("> ") { match readline { Ok(line) => { println!("Line: {}", line); }, Err(err) => { println!("Error: {:?}", err); break } } }