Struct datafusion_rustyline::history::History [−][src]
pub struct History { /* fields omitted */ }
Current state of the history.
Methods
impl History
[src]
impl History
pub fn new() -> History
[src]
pub fn new() -> History
pub fn with_config(config: Config) -> History
[src]
pub fn with_config(config: Config) -> History
pub fn get(&self, index: usize) -> Option<&String>
[src]
pub fn get(&self, index: usize) -> Option<&String>
Return the history entry at position index
, starting from 0.
pub fn last(&self) -> Option<&String>
[src]
pub fn last(&self) -> Option<&String>
Return the last history entry (i.e. previous command)
pub fn add<S: AsRef<str> + Into<String>>(&mut self, line: S) -> bool
[src]
pub fn add<S: AsRef<str> + Into<String>>(&mut self, line: S) -> bool
Add a new entry in the history.
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
Return the number of entries in the history.
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Return true if the history has no entry.
pub fn set_max_len(&mut self, len: usize)
[src]
pub fn set_max_len(&mut self, len: usize)
Set the maximum length for the history. This function can be called even
if there is already some history, the function will make sure to retain
just the latest len
elements if the new history length value is
smaller than the amount of items already inside the history.
Like [stifle_history](http://cnswww.cns.cwru. edu/php/chet/readline/history.html#IDX11).
pub fn save<P: AsRef<Path> + ?Sized>(&self, path: &P) -> Result<()>
[src]
pub fn save<P: AsRef<Path> + ?Sized>(&self, path: &P) -> Result<()>
Save the history in the specified file.
pub fn load<P: AsRef<Path> + ?Sized>(&mut self, path: &P) -> Result<()>
[src]
pub fn load<P: AsRef<Path> + ?Sized>(&mut self, path: &P) -> Result<()>
Load the history from the specified file.
Errors
Will return Err
if path does not already exist or could not be read.
pub fn clear(&mut self)
[src]
pub fn clear(&mut self)
Clear history
pub fn search(&self, term: &str, start: usize, dir: Direction) -> Option<usize>
[src]
pub fn search(&self, term: &str, start: usize, dir: Direction) -> Option<usize>
Search history (start position inclusive [0, len-1]).
Return the absolute index of the nearest history entry that matches
term
.
Return None if no entry contains term
between [start, len -1] for
forward search
or between [0, start] for reverse search.
pub fn starts_with(
&self,
term: &str,
start: usize,
dir: Direction
) -> Option<usize>
[src]
pub fn starts_with(
&self,
term: &str,
start: usize,
dir: Direction
) -> Option<usize>
Anchored search
ⓘImportant traits for Iter<'a>pub fn iter(&self) -> Iter
[src]
pub fn iter(&self) -> Iter
Return a forward iterator.
Trait Implementations
impl Default for History
[src]
impl Default for History
impl Index<usize> for History
[src]
impl Index<usize> for History
type Output = String
The returned type after indexing.
fn index(&self, index: usize) -> &String
[src]
fn index(&self, index: usize) -> &String
Performs the indexing (container[index]
) operation.
impl<'a> IntoIterator for &'a History
[src]
impl<'a> IntoIterator for &'a History