Trait reedline::Completer

source ·
pub trait Completer: Send {
    // Required method
    fn complete(&mut self, line: &str, pos: usize) -> Vec<Suggestion>;

    // Provided methods
    fn complete_with_base_ranges(
        &mut self,
        line: &str,
        pos: usize
    ) -> (Vec<Suggestion>, Vec<Range<usize>>) { ... }
    fn partial_complete(
        &mut self,
        line: &str,
        pos: usize,
        start: usize,
        offset: usize
    ) -> Vec<Suggestion> { ... }
    fn total_completions(&mut self, line: &str, pos: usize) -> usize { ... }
}
Expand description

A trait that defines how to convert some text and a position to a list of potential completions in that position. The text could be a part of the whole line, and the position is the index of the end of the text in the original line.

Required Methods§

source

fn complete(&mut self, line: &str, pos: usize) -> Vec<Suggestion>

the action that will take the line and position and convert it to a vector of completions, which include the span to replace and the contents of that replacement

Provided Methods§

source

fn complete_with_base_ranges( &mut self, line: &str, pos: usize ) -> (Vec<Suggestion>, Vec<Range<usize>>)

same as Completer::complete but it will return a vector of ranges of the strings the suggestions are based on

source

fn partial_complete( &mut self, line: &str, pos: usize, start: usize, offset: usize ) -> Vec<Suggestion>

action that will return a partial section of available completions this command comes handy when trying to avoid to pull all the data at once from the completer

source

fn total_completions(&mut self, line: &str, pos: usize) -> usize

number of available completions

Implementors§