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§
Sourcefn is_stdin(&self) -> bool
fn is_stdin(&self) -> bool
If this input is coming from STDIN, and as such an input display should be rendered.
Sourcefn set_active(&mut self, active: bool) -> Result<(), LisaError>
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.
Sourcefn input_in_progress(&self) -> bool
fn input_in_progress(&self) -> bool
If this provider has some active input, and someone is actively ‘typing’.
Sourcefn current_input(&self) -> String
fn current_input(&self) -> String
Get any current input that has been provided.
Sourcefn poll_for_input(&mut self, ansi_supported: bool) -> Vec<TerminalInputEvent>
fn poll_for_input(&mut self, ansi_supported: bool) -> Vec<TerminalInputEvent>
Poll for any active input events.
Sourcefn set_autocomplete_provider(
&mut self,
autocomplete: Box<dyn AutocompleteProvider>,
)
fn set_autocomplete_provider( &mut self, autocomplete: Box<dyn AutocompleteProvider>, )
Set the current autocomplete provider for this input provider.
Sourcefn current_autocomplete_suggestion(&self) -> Option<String>
fn current_autocomplete_suggestion(&self) -> Option<String>
Get the current autocomplete suggestion.
Sourcefn autocomplete_suggestion_pending(&self) -> bool
fn autocomplete_suggestion_pending(&self) -> bool
If an autocomplete suggestion is pending, but not yet completed.
Sourcefn set_history_provider(&mut self, history: Box<dyn HistoryProvider>)
fn set_history_provider(&mut self, history: Box<dyn HistoryProvider>)
Set the current history provider.
Sourcefn current_history_search_value(&self) -> Option<String>
fn current_history_search_value(&self) -> Option<String>
Get the current history search value that is being found.