pub fn push(&mut self, new_item: Buffer) -> io::Result<()> {
        // buffers[0] is the oldest entry
        // the new entry goes to the end
        if !self.append_duplicate_entries
            && self.buffers.back().map(|b| b.to_string()) == Some(new_item.to_string())
        {
            return Ok(());
        }

        self.buffers.push_back(new_item);
        while self.buffers.len() > self.max_buffers_size {
            self.buffers.pop_front();
        }
        Ok(())
    }
/// 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.
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.
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 .
pub fn push(&mut self, new_item: Buffer) -> io::Result<()> {
        // buffers[0] is the oldest entry
        // the new entry goes to the end
        if !self.append_duplicate_entries
            && self.buffers.back().map(|b| b.to_string()) == Some(new_item.to_string())
        {
            return Ok(());
        }
        self.buffers.push_back(new_item);
        while self.buffers.len() > self.max_buffers_size {
            self.buffers.pop_front();
        }
        Ok(())
    }
pub fn push ( & mut self , new_item : Buffer ) -> io :: Result < ( ) > { // buffers[0] is the oldest entry // the new entry goes to the end if ! self . append_duplicate_entries && self . buffers . back ( ) . map ( | b | b . to_string ( ) ) == Some ( new_item . to_string ( ) ) { return Ok ( ( ) ) ; } self . buffers . push_back ( new_item ) ; while self . buffers . len ( ) > self . max_buffers_size { self . buffers . pop_front ( ) ; } Ok ( ( ) ) }
Add a command to the history buffer and remove the oldest commands when the max history
size has been met.
Add a command to the history buffer and remove the oldest commands when the max history size has been met .
&mut self
new_item
Buffer
&mut self
new_item
Buffer