/// Appends an element to the back, efficiently and in constant time.
Appends an element to the back, efficiently and in constant time.
Appends an element to the back efficiently and in constant time .
pub fn push(&mut self, value: T) {
        let reuse = self.pieces.last().map_or
            (false, |last| last.buffer == Add
             && last.start+last.length == self.adds.len());
        self.adds.push(value);
        if reuse {
            self.pieces.last_mut().unwrap().length += 1;
        } else {
            self.pieces.push(Piece {
                start: self.adds.len()-1,
                length: 1,
                buffer: Add,
            });
        }
        self.last_idx = self.length;
        self.length += 1;
        self.reusable_insert = Some((self.pieces.len()-1, true));
        self.reusable_remove = None;
    }
pub fn push ( & mut self , value : T ) { let reuse = self . pieces . last ( ) . map_or ( false , | last | last . buffer == Add && last . start + last . length == self . adds . len ( ) ) ; self . adds . push ( value ) ; if reuse { self . pieces . last_mut ( ) . unwrap ( ) . length += 1 ; } else { self . pieces . push ( Piece { start : self . adds . len ( ) - 1 , length : 1 , buffer : Add , } ) ; } self . last_idx = self . length ; self . length += 1 ; self . reusable_insert = Some ( ( self . pieces . len ( ) - 1 , true ) ) ; self . reusable_remove = None ; }
Appends an element to the back, efficiently and in constant time.
Appends an element to the back efficiently and in constant time .
&mut self
value
T