Trait rustyline::completion::Completer
source · pub trait Completer {
type Candidate: Candidate;
// Provided methods
fn complete(
&self,
line: &str,
pos: usize,
ctx: &Context<'_>,
) -> Result<(usize, Vec<Self::Candidate>)> { ... }
fn update(&self, line: &mut LineBuffer, start: usize, elected: &str) { ... }
}
Expand description
To be called for tab-completion.
Required Associated Types§
Provided Methods§
sourcefn complete(
&self,
line: &str,
pos: usize,
ctx: &Context<'_>,
) -> Result<(usize, Vec<Self::Candidate>)>
fn complete( &self, line: &str, pos: usize, ctx: &Context<'_>, ) -> Result<(usize, Vec<Self::Candidate>)>
Takes the currently edited line
with the cursor pos
ition and
returns the start position and the completion candidates for the
partial word to be completed.
(“ls /usr/loc”, 11) => Ok((3, vec![“/usr/local/”]))
sourcefn update(&self, line: &mut LineBuffer, start: usize, elected: &str)
fn update(&self, line: &mut LineBuffer, start: usize, elected: &str)
Updates the edited line
with the elected
candidate.