pub struct FileHistory { /* private fields */ }Expand description
Current state of the history stored in a file.
Implementations§
Source§impl FileHistory
impl FileHistory
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().
Sourcepub fn iter(&self) -> impl DoubleEndedIterator<Item = &String> + '_
pub fn iter(&self) -> impl DoubleEndedIterator<Item = &String> + '_
Return a forward iterator.
Trait Implementations§
Source§impl Default for FileHistory
impl Default for FileHistory
Source§fn default() -> FileHistory
fn default() -> FileHistory
Returns the “default value” for a type. Read more
Source§impl History for FileHistory
Available on crate feature with-file-history only.
impl History for FileHistory
Available on crate feature
with-file-history only.Source§fn get(
&self,
index: usize,
dir: SearchDirection,
) -> Result<Option<SearchResult<'_>>>
fn get( &self, index: usize, dir: SearchDirection, ) -> Result<Option<SearchResult<'_>>>
Return the history entry at position
index, starting from 0. Read moreSource§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: &Path) -> Result<()>
fn load(&mut self, path: &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 FileHistory
Available on crate feature with-file-history only.
impl Index<usize> for FileHistory
Available on crate feature
with-file-history only.Source§impl<'a> IntoIterator for &'a FileHistory
Available on crate feature with-file-history only.
impl<'a> IntoIterator for &'a FileHistory
Available on crate feature
with-file-history only.Auto Trait Implementations§
impl Freeze for FileHistory
impl RefUnwindSafe for FileHistory
impl Send for FileHistory
impl Sync for FileHistory
impl Unpin for FileHistory
impl UnwindSafe for FileHistory
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