pub trait History {
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
Lookup the line corresponding to an index.
fn last(&self) -> Option<HistoryIndex>
fn last(&self) -> Option<HistoryIndex>
Return the index for the most recently added entry.
Add an entry. Note that the LineEditor will not automatically call the add method.
fn 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.