[go: up one dir, main page]

History

Trait History 

Source
pub trait History {
    // Required methods
    fn get(&self, idx: HistoryIndex) -> Option<Cow<'_, str>>;
    fn last(&self) -> Option<HistoryIndex>;
    fn add(&mut self, line: &str);
    fn search(
        &self,
        idx: HistoryIndex,
        style: SearchStyle,
        direction: SearchDirection,
        pattern: &str,
    ) -> Option<SearchResult<'_>>;
}
Expand description

Defines the history interface for the line editor.

Required Methods§

Source

fn get(&self, idx: HistoryIndex) -> Option<Cow<'_, str>>

Lookup the line corresponding to an index.

Source

fn last(&self) -> Option<HistoryIndex>

Return the index for the most recently added entry.

Source

fn add(&mut self, line: &str)

Add an entry. Note that the LineEditor will not automatically call the add method.

Source

fn search( &self, idx: HistoryIndex, style: SearchStyle, direction: SearchDirection, pattern: &str, ) -> Option<SearchResult<'_>>

Search for a matching entry relative to the specified history index.

Implementors§