[−][src]Struct liner::Context
Fields
history: History
word_divider_fn: Box<dyn Fn(&Buffer) -> Vec<(usize, usize)>>
key_bindings: KeyBindings
buf: String
Methods
impl Context
[src]
pub fn new() -> Self
[src]
pub fn read_line<P: Into<String>, C: Completer>(
&mut self,
prompt: P,
f: Option<ColorClosure>,
handler: &mut C
) -> Result<String>
[src]
&mut self,
prompt: P,
f: Option<ColorClosure>,
handler: &mut C
) -> Result<String>
Creates an Editor
and feeds it keypresses from stdin until the line is entered.
The output is stdout.
The returned line has the newline removed.
Before returning, will revert all changes to the history buffers.
pub fn read_line_with_init_buffer<P: Into<String>, B: Into<Buffer>, C: Completer>(
&mut self,
prompt: P,
handler: &mut C,
f: Option<ColorClosure>,
buffer: B
) -> Result<String>
[src]
&mut self,
prompt: P,
handler: &mut C,
f: Option<ColorClosure>,
buffer: B
) -> Result<String>
Same as Context.read_line()
, but passes the provided initial buffer to the editor.
use liner::{Context, Completer}; struct EmptyCompleter; impl Completer for EmptyCompleter { fn completions(&mut self, _start: &str) -> Vec<String> { Vec::new() } } let mut context = Context::new(); let line = context.read_line_with_init_buffer("[prompt]$ ", &mut EmptyCompleter, Some(Box::new(|s| String::from(s))), "some initial buffer");
pub fn revert_all_history(&mut self)
[src]
Trait Implementations
Auto Trait Implementations
impl !Send for Context
impl !Sync for Context
impl Unpin for Context
impl !UnwindSafe for Context
impl !RefUnwindSafe for Context
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,