Struct rustyline::history::MemHistory
source · pub struct MemHistory { /* private fields */ }
Expand description
Transient in-memory history implementation.
Implementations§
source§impl MemHistory
impl MemHistory
sourcepub fn with_config(config: Config) -> Self
pub fn with_config(config: Config) -> Self
Customized constructor with:
Config::max_history_size()
,Config::history_ignore_space()
,Config::history_duplicates()
.
Trait Implementations§
source§impl Default for MemHistory
impl Default for MemHistory
source§impl History for MemHistory
impl History for MemHistory
source§fn get(
&self,
index: usize,
_: SearchDirection,
) -> Result<Option<SearchResult<'_>>>
fn get( &self, index: usize, _: SearchDirection, ) -> Result<Option<SearchResult<'_>>>
Return the history entry at position
index
, starting from 0. Read moresource§fn add_owned(&mut self, line: String) -> Result<bool>
fn add_owned(&mut self, line: String) -> Result<bool>
Add a new entry in the history. Read more
source§fn set_max_len(&mut self, len: usize) -> Result<()>
fn set_max_len(&mut self, len: usize) -> Result<()>
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. Read moresource§fn ignore_space(&mut self, yes: bool)
fn ignore_space(&mut self, yes: bool)
Ignore lines which begin with a space or not
source§fn load(&mut self, _: &Path) -> Result<()>
fn load(&mut self, _: &Path) -> Result<()>
Load the history from the specified file. Read more
source§fn search(
&self,
term: &str,
start: usize,
dir: SearchDirection,
) -> Result<Option<SearchResult<'_>>>
fn search( &self, term: &str, start: usize, dir: SearchDirection, ) -> Result<Option<SearchResult<'_>>>
Search history (start position inclusive [0, len-1]). Read more
source§fn starts_with(
&self,
term: &str,
start: usize,
dir: SearchDirection,
) -> Result<Option<SearchResult<'_>>>
fn starts_with( &self, term: &str, start: usize, dir: SearchDirection, ) -> Result<Option<SearchResult<'_>>>
Anchored search
source§impl Index<usize> for MemHistory
impl Index<usize> for MemHistory
Auto Trait Implementations§
impl Freeze for MemHistory
impl RefUnwindSafe for MemHistory
impl Send for MemHistory
impl Sync for MemHistory
impl Unpin for MemHistory
impl UnwindSafe for MemHistory
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more