pub fn push_overwrite(&mut self, elem: T) -> Option<T> {
        let index = (self.oldest + self.num_elems) % SIZE;
        if self.is_full() {
            let oldest = self.data[self.oldest];
            self.oldest = (self.oldest + 1) % SIZE;
            self.data[index] = elem;
            Some(oldest)
        } else {
            self.data[index] = elem;
            self.num_elems += 1;
            None
        }
    }
/// Push something onto the buffer. If the buffer is full, the oldest element is returned.
Push something onto the buffer. If the buffer is full, the oldest element is returned.
Push something onto the buffer . If the buffer is full the oldest element is returned .
pub fn push_overwrite(&mut self, elem: T) -> Option<T> {
        let index = (self.oldest + self.num_elems) % SIZE;
        if self.is_full() {
            let oldest = self.data[self.oldest];
            self.oldest = (self.oldest + 1) % SIZE;
            self.data[index] = elem;
            Some(oldest)
        } else {
            self.data[index] = elem;
            self.num_elems += 1;
            None
        }
    }
pub fn push_overwrite ( & mut self , elem : T ) -> Option < T > { let index = ( self . oldest + self . num_elems ) % SIZE ; if self . is_full ( ) { let oldest = self . data [ self . oldest ] ; self . oldest = ( self . oldest + 1 ) % SIZE ; self . data [ index ] = elem ; Some ( oldest ) } else { self . data [ index ] = elem ; self . num_elems += 1 ; None } }
Push something onto the buffer.
Push something onto the buffer .
&mut self
elem
T
&mut self
elem
T