Skip to main content

Completer

Trait Completer 

Source
pub trait Completer {
    // Required method
    fn completions(&mut self, input: &str) -> Vec<CompletionResult>;

    // Provided methods
    fn columns(&self) -> Vec<Column> { ... }
    fn column_count(&self) -> usize { ... }
    fn complete_result(&self, value: &str) -> String { ... }
    fn have_command(&self) -> bool { ... }
    fn text_column(&self) -> i32 { ... }
}
Expand description

The trait completer is an interface to be satisfied by input completers.

Required Methods§

Source

fn completions(&mut self, input: &str) -> Vec<CompletionResult>

From the user input, return the completion results. The results are on two columns, hence the 2-tuple.

Provided Methods§

Source

fn columns(&self) -> Vec<Column>

The number of columns of the completer.

Source

fn column_count(&self) -> usize

The number of column.

Source

fn complete_result(&self, value: &str) -> String

From the selected text entry, return the text that should be written in the text input.

Source

fn have_command(&self) -> bool

Return true if the completer is for an input containing a command. Return false otherwise. This will have the effect of removing the command when there’s one it set to true.

Source

fn text_column(&self) -> i32

Set the column to use as the result of a selected text entry.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§