Struct rustyline::history::FileHistory
source · 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
impl History for FileHistory
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
impl Index<usize> for FileHistory
Auto Trait Implementations§
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