pub struct FileHistory { /* private fields */ }
Expand description
Current state of the history stored in a file.
Implementations§
Source§impl FileHistory
impl FileHistory
Sourcepub fn new() -> FileHistory
pub fn new() -> FileHistory
Default constructor
Sourcepub fn with_config(config: Config) -> FileHistory
pub fn with_config(config: Config) -> FileHistory
Customized constructor with:
Config::max_history_size()
,Config::history_ignore_space()
,Config::history_duplicates()
.
Sourcepub fn iter(&self) -> impl DoubleEndedIterator
pub fn iter(&self) -> impl DoubleEndedIterator
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<'_>>, ReadlineError>
fn get( &self, index: usize, dir: 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: &Path) -> Result<(), ReadlineError>
fn save(&mut self, path: &Path) -> Result<(), ReadlineError>
Save the history in the specified file.
Source§fn append(&mut self, path: &Path) -> Result<(), ReadlineError>
fn append(&mut self, path: &Path) -> Result<(), ReadlineError>
Append new entries in the specified file.
Source§fn load(&mut self, path: &Path) -> Result<(), ReadlineError>
fn load(&mut self, path: &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 FileHistory
impl Index<usize> for FileHistory
Source§impl<'a> IntoIterator for &'a FileHistory
impl<'a> IntoIterator for &'a FileHistory
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
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