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§
Sourcefn get(&self, idx: HistoryIndex) -> Option<Cow<'_, str>>
fn get(&self, idx: HistoryIndex) -> Option<Cow<'_, str>>
Lookup the line corresponding to an index.
Sourcefn last(&self) -> Option<HistoryIndex>
fn last(&self) -> Option<HistoryIndex>
Return the index for the most recently added entry.
Sourcefn add(&mut self, line: &str)
fn add(&mut self, line: &str)
Add an entry. Note that the LineEditor will not automatically call the add method.
Sourcefn search(
&self,
idx: HistoryIndex,
style: SearchStyle,
direction: SearchDirection,
pattern: &str,
) -> Option<SearchResult<'_>>
fn search( &self, idx: HistoryIndex, style: SearchStyle, direction: SearchDirection, pattern: &str, ) -> Option<SearchResult<'_>>
Search for a matching entry relative to the specified history index.