Struct fm::completion::Completion
source · pub struct Completion {
pub proposals: Vec<String>,
pub index: usize,
/* private fields */
}Expand description
Holds a Vec<String> of possible completions and an usize index
showing where the user is in the vec.
Fields§
§proposals: Vec<String>Possible completions
index: usizeWhich completion is selected by the user
Implementations§
source§impl Completion
impl Completion
pub fn set_kind(&mut self, mode: &Mode)
sourcepub fn next(&mut self)
pub fn next(&mut self)
Move the index to next element, cycling to 0. Does nothing if the list is empty.
sourcepub fn prev(&mut self)
pub fn prev(&mut self)
Move the index to previous element, cycling to the last one. Does nothing if the list is empty.
sourcepub fn current_proposition(&self) -> &str
pub fn current_proposition(&self) -> &str
Returns the currently selected proposition.
Returns an empty string if proposals is empty.
sourcepub fn goto(&mut self, input_string: &str, current_path: &str) -> Result<()>
pub fn goto(&mut self, input_string: &str, current_path: &str) -> Result<()>
Goto completion. Looks for the valid path completing what the user typed.
sourcepub fn exec(&mut self, input_string: &str) -> Result<()>
pub fn exec(&mut self, input_string: &str) -> Result<()>
Looks for programs in $PATH completing the one typed by the user.
pub fn command(&mut self, input_string: &str) -> Result<()>
sourcepub fn search_from_normal(
&mut self,
input_string: &str,
path_content: &PathContent
) -> Result<()>
pub fn search_from_normal( &mut self, input_string: &str, path_content: &PathContent ) -> Result<()>
Looks for file within current folder completing what the user typed.
sourcepub fn search_from_tree(
&mut self,
input_string: &str,
content: &[(String, ColoredString)]
) -> Result<()>
pub fn search_from_tree( &mut self, input_string: &str, content: &[(String, ColoredString)] ) -> Result<()>
Looks for file within tree completing what the user typed.
sourcepub fn complete_input_string(&self, input_string: &str) -> Option<&str>
pub fn complete_input_string(&self, input_string: &str) -> Option<&str>
Complete the input string with current_proposition if possible. Returns the optional last chars of the current_proposition. If the current_proposition doesn’t start with input_string, it returns None.
Trait Implementations§
source§impl Clone for Completion
impl Clone for Completion
source§fn clone(&self) -> Completion
fn clone(&self) -> Completion
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more