pub struct History {
pub buffers: VecDeque<Buffer>,
pub append_duplicate_entries: bool,
/* private fields */
}
Expand description
Structure encapsulating command history
Fields§
§buffers: VecDeque<Buffer>
Vector of buffers to store history in
append_duplicate_entries: bool
Implementations§
Source§impl History
impl History
Sourcepub fn commit_history(&mut self)
pub fn commit_history(&mut self)
It’s important to execute this function before exiting your program, as it will ensure that all history data has been written to the disk.
Sourcepub fn push(&mut self, new_item: Buffer) -> Result<()>
pub fn push(&mut self, new_item: Buffer) -> Result<()>
Add a command to the history buffer and remove the oldest commands when the max history size has been met. If writing to the disk is enabled, this function will be used for logging history to the designated history file.
Sourcepub fn get_newest_match<'a, 'b>(
&'a self,
curr_position: Option<usize>,
new_buff: &'b Buffer,
) -> Option<&'a Buffer>
pub fn get_newest_match<'a, 'b>( &'a self, curr_position: Option<usize>, new_buff: &'b Buffer, ) -> Option<&'a Buffer>
Go through the history and try to find a buffer which starts the same as the new buffer given to this function as argument.
Sourcepub fn set_file_name(&mut self, name: Option<String>)
pub fn set_file_name(&mut self, name: Option<String>)
Set history file name. At the same time enable history.
Sourcepub fn set_max_size(&mut self, size: usize)
pub fn set_max_size(&mut self, size: usize)
Set maximal number of buffers stored in memory
Sourcepub fn set_max_file_size(&mut self, size: usize)
pub fn set_max_file_size(&mut self, size: usize)
Set maximal number of entries in history file
Sourcepub fn load_history(&mut self) -> Result<()>
pub fn load_history(&mut self) -> Result<()>
Load history from given file name
Trait Implementations§
Auto Trait Implementations§
impl Freeze for History
impl !RefUnwindSafe for History
impl Send for History
impl Sync for History
impl Unpin for History
impl !UnwindSafe for History
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