pub struct MemHistory { /* private fields */ }
Expand description
Transient in-memory history implementation.
Implementations§
Source§impl MemHistory
impl MemHistory
Sourcepub fn new() -> MemHistory
pub fn new() -> MemHistory
Default constructor
Sourcepub fn with_config(config: Config) -> MemHistory
pub fn with_config(config: Config) -> MemHistory
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§fn default() -> MemHistory
fn default() -> MemHistory
Returns the “default value” for a type. Read more
Source§impl History for MemHistory
impl History for MemHistory
Source§fn get(
&self,
index: usize,
_: SearchDirection,
) -> Result<Option<SearchResult<'_>>, ReadlineError>
fn get( &self, index: usize, _: SearchDirection, ) -> Result<Option<SearchResult<'_>>, ReadlineError>
Return the history entry at position
index
, starting from 0. Read moreSource§fn add(&mut self, line: &str) -> Result<bool, ReadlineError>
fn add(&mut self, line: &str) -> Result<bool, ReadlineError>
Add a new entry in the history. Read more
Source§fn add_owned(&mut self, line: String) -> Result<bool, ReadlineError>
fn add_owned(&mut self, line: String) -> Result<bool, ReadlineError>
Add a new entry in the history. Read more
Source§fn set_max_len(&mut self, len: usize) -> Result<(), ReadlineError>
fn set_max_len(&mut self, len: usize) -> Result<(), ReadlineError>
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_dups(&mut self, yes: bool) -> Result<(), ReadlineError>
fn ignore_dups(&mut self, yes: bool) -> Result<(), ReadlineError>
Ignore consecutive duplicates
Source§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 save(&mut self, _: &Path) -> Result<(), ReadlineError>
fn save(&mut self, _: &Path) -> Result<(), ReadlineError>
Save the history in the specified file.
Source§fn append(&mut self, _: &Path) -> Result<(), ReadlineError>
fn append(&mut self, _: &Path) -> Result<(), ReadlineError>
Append new entries in the specified file.
Source§fn load(&mut self, _: &Path) -> Result<(), ReadlineError>
fn load(&mut self, _: &Path) -> Result<(), ReadlineError>
Load the history from the specified file. Read more
Source§fn search(
&self,
term: &str,
start: usize,
dir: SearchDirection,
) -> Result<Option<SearchResult<'_>>, ReadlineError>
fn search( &self, term: &str, start: usize, dir: SearchDirection, ) -> Result<Option<SearchResult<'_>>, ReadlineError>
Search history (start position inclusive [0, len-1]). Read more
Source§fn starts_with(
&self,
term: &str,
start: usize,
dir: SearchDirection,
) -> Result<Option<SearchResult<'_>>, ReadlineError>
fn starts_with( &self, term: &str, start: usize, dir: SearchDirection, ) -> Result<Option<SearchResult<'_>>, ReadlineError>
Anchored search
Source§impl Index<usize> for MemHistory
impl Index<usize> for MemHistory
Source§impl<'a> IntoIterator for &'a MemHistory
impl<'a> IntoIterator for &'a 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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more