Thanks to visit codestin.com
Credit goes to docs.rs

Skip to main content

Completer

Trait 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

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§