pub struct Editor<C: Completer> { /* private fields */ }
Expand description
Line editor
Implementations§
Source§impl<C: Completer> Editor<C>
impl<C: Completer> Editor<C>
pub fn new() -> Editor<C>
pub fn with_config(config: Config) -> Editor<C>
Sourcepub fn readline(&mut self, prompt: &str) -> Result<String>
pub fn readline(&mut self, prompt: &str) -> Result<String>
This method will read a line from STDIN and will display a prompt
Sourcepub fn load_history<P: AsRef<Path> + ?Sized>(&mut self, path: &P) -> Result<()>
pub fn load_history<P: AsRef<Path> + ?Sized>(&mut self, path: &P) -> Result<()>
Load the history from the specified file.
Sourcepub fn save_history<P: AsRef<Path> + ?Sized>(&self, path: &P) -> Result<()>
pub fn save_history<P: AsRef<Path> + ?Sized>(&self, path: &P) -> Result<()>
Save the history in the specified file.
Sourcepub fn add_history_entry<S: AsRef<str> + Into<String>>(
&mut self,
line: S,
) -> bool
pub fn add_history_entry<S: AsRef<str> + Into<String>>( &mut self, line: S, ) -> bool
Add a new entry in the history.
Sourcepub fn clear_history(&mut self)
pub fn clear_history(&mut self)
Clear history.
Sourcepub fn get_history(&mut self) -> &mut History
pub fn get_history(&mut self) -> &mut History
Return a reference to the history object.
Sourcepub fn set_completer(&mut self, completer: Option<C>)
pub fn set_completer(&mut self, completer: Option<C>)
Register a callback function to be called for tab-completion.
Trait Implementations§
Auto Trait Implementations§
impl<C> Freeze for Editor<C>where
C: Freeze,
impl<C> RefUnwindSafe for Editor<C>where
C: RefUnwindSafe,
impl<C> Send for Editor<C>where
C: Send,
impl<C> Sync for Editor<C>where
C: Sync,
impl<C> Unpin for Editor<C>where
C: Unpin,
impl<C> UnwindSafe for Editor<C>where
C: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more