Trait linefeed::complete::Completer
[−]
[src]
pub trait Completer<Term: Terminal> { fn complete(
&self,
word: &str,
reader: &Reader<Term>,
start: usize,
end: usize
) -> Option<Vec<Completion>>; fn word_start(&self, line: &str, end: usize, reader: &Reader<Term>) -> usize { ... } fn quote<'a>(&self, word: &'a str) -> Cow<'a, str> { ... } fn unquote<'a>(&self, word: &'a str) -> Cow<'a, str> { ... } }
Performs completion for Reader
when triggered by a user input sequence
Required Methods
fn complete(
&self,
word: &str,
reader: &Reader<Term>,
start: usize,
end: usize
) -> Option<Vec<Completion>>
&self,
word: &str,
reader: &Reader<Term>,
start: usize,
end: usize
) -> Option<Vec<Completion>>
Returns the set of possible completions for the prefix word
.
Provided Methods
fn word_start(&self, line: &str, end: usize, reader: &Reader<Term>) -> usize
Returns the starting position of the word under the cursor.
The default implementation uses Reader::word_break_chars()
to
detect the start of a word.
fn quote<'a>(&self, word: &'a str) -> Cow<'a, str>
Quotes a possible completion for insertion into input.
The default implementation returns the word, as is.
fn unquote<'a>(&self, word: &'a str) -> Cow<'a, str>
Unquotes a piece of user input before searching for completions.
The default implementation returns the word, as is.
Implementors
impl<Term: Terminal> Completer<Term> for DummyCompleter
impl<Term: Terminal> Completer<Term> for PathCompleter