pub fn write(&mut self, val: T) -> Option<T> {
        let r = if self.is_full() {
            Some(mem::replace(&mut self.buffer[self.write_index], val))
        } else {
            self.buffer.push(val);

            None
        };

        self.write_index = (self.write_index.wrapping_add(1)) % self.max_size;
        self.last_data_at = time::Instant::now();

        r
    }
/// Write a new value into the buffer, if it overwrites an old value it is returned.
Write a new value into the buffer, if it overwrites an old value it is returned.
Write a new value into the buffer if it overwrites an old value it is returned .
pub fn write(&mut self, val: T) -> Option<T> {
        let r = if self.is_full() {
            Some(mem::replace(&mut self.buffer[self.write_index], val))
        } else {
            self.buffer.push(val);
            None
        };
        self.write_index = (self.write_index.wrapping_add(1)) % self.max_size;
        self.last_data_at = time::Instant::now();
        r
    }
pub fn write ( & mut self , val : T ) -> Option < T > { let r = if self . is_full ( ) { Some ( mem :: replace ( & mut self . buffer [ self . write_index ] , val ) ) } else { self . buffer . push ( val ) ; None } ; self . write_index = ( self . write_index . wrapping_add ( 1 ) ) % self . max_size ; self . last_data_at = time :: Instant :: now ( ) ; r }
Write a new value into the buffer, if it overwrites an old value it is returned.
Write a new value into the buffer if it overwrites an old value it is returned .
&mut self
val
T
&mut self
val
T