InputProvider

Trait InputProvider 

Source
pub trait InputProvider: Send + Sync {
Show 13 methods // Required methods fn is_stdin(&self) -> bool; fn is_active(&self) -> bool; fn set_active(&mut self, active: bool) -> Result<(), LisaError>; fn input_in_progress(&self) -> bool; fn current_input(&self) -> String; fn poll_for_input( &mut self, ansi_supported: bool, ) -> Vec<TerminalInputEvent>; fn set_autocomplete_provider( &mut self, autocomplete: Box<dyn AutocompleteProvider>, ); fn current_autocomplete_suggestion(&self) -> Option<String>; fn autocomplete_suggestion_pending(&self) -> bool; fn set_history_provider(&mut self, history: Box<dyn HistoryProvider>); fn current_history_search_value(&self) -> Option<String>; fn is_doing_history_search(&self) -> bool; fn inputs(&mut self) -> Vec<String>;
}
Expand description

An input provider is something that is capable of receiving input from users, holding it, and producing a value to some console at some point in time.

The input providers job is to provide input events to displays (and potentially others) and keep state of the current input.

Required Methods§

Source

fn is_stdin(&self) -> bool

If this input is coming from STDIN, and as such an input display should be rendered.

Source

fn is_active(&self) -> bool

If the input provider is active, and accepting input.

Source

fn set_active(&mut self, active: bool) -> Result<(), LisaError>

Set this terminal as ‘active’.

§Errors

If the underlying provider cannot do what it needs to be made active.

Source

fn input_in_progress(&self) -> bool

If this provider has some active input, and someone is actively ‘typing’.

Source

fn current_input(&self) -> String

Get any current input that has been provided.

Source

fn poll_for_input(&mut self, ansi_supported: bool) -> Vec<TerminalInputEvent>

Poll for any active input events.

Source

fn set_autocomplete_provider( &mut self, autocomplete: Box<dyn AutocompleteProvider>, )

Set the current autocomplete provider for this input provider.

Source

fn current_autocomplete_suggestion(&self) -> Option<String>

Get the current autocomplete suggestion.

Source

fn autocomplete_suggestion_pending(&self) -> bool

If an autocomplete suggestion is pending, but not yet completed.

Source

fn set_history_provider(&mut self, history: Box<dyn HistoryProvider>)

Set the current history provider.

Source

fn current_history_search_value(&self) -> Option<String>

Get the current history search value that is being found.

Source

fn inputs(&mut self) -> Vec<String>

Get any fully complete inputs that have occured since things last ran.

Implementors§

Source§

impl<ReadTy: ReadProvider> InputProvider for StdinInputProvider<ReadTy>