[go: up one dir, main page]

rustyline 0.1.0

Rustyline, a readline implementation based on Antirez's Linenoise
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Completion API

/// To be called for tab-completion.
pub trait Completer {
    /// Takes the currently edited `line` with the cursor `pos`ition and
    /// returns the completion candidates for the partial word to be completed.
    fn complete(&self, line: &str, pos: usize) -> Vec<String>;
    /// Takes the currently edited `line` with the cursor `pos`ition and
    /// the `elected` candidate.
    /// Returns the new line content and cursor position.
    fn update(&self, _line: &str, _pos: usize, elected: &str) -> (String, usize) {
        // line completion (vs word completion)
        (String::from(elected), elected.len())
    }
}