[][src]Struct tcalc_rustyline::Editor

pub struct Editor<C: Completer> { /* fields omitted */ }

Line editor

Methods

impl<C: Completer> Editor<C>[src]

pub fn new() -> Editor<C>[src]

pub fn with_config(config: Config) -> Editor<C>[src]

pub fn readline(&mut self, prompt: &str) -> Result<String>[src]

This method will read a line from STDIN and will display a prompt

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>(&self, path: &P) -> Result<()>[src]

Save the history in the specified file.

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]

Clear history.

pub fn get_history(&mut self) -> &mut History[src]

Return a reference to the history object.

pub fn set_completer(&mut self, completer: Option<C>)[src]

Register a callback function to be called for tab-completion.

Important traits for Iter<'a, C>
pub fn iter<'a>(&'a mut self, prompt: &'a str) -> Iter<C>[src]

let mut rl = tcalc_rustyline::Editor::<()>::new();
for readline in rl.iter("> ") {
    match readline {
        Ok(line) => {
            println!("Line: {}", line);
        },
        Err(err) => {
            println!("Error: {:?}", err);
            break
        }
    }
}

Trait Implementations

impl<C: Completer> Debug for Editor<C>[src]

Auto Trait Implementations

impl<C> Send for Editor<C> where
    C: Send

impl<C> Unpin for Editor<C> where
    C: Unpin

impl<C> Sync for Editor<C> where
    C: Sync

impl<C> UnwindSafe for Editor<C> where
    C: UnwindSafe

impl<C> RefUnwindSafe for Editor<C> where
    C: RefUnwindSafe

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]