pub fn try_push(&mut self, el: T) -> Result<T> {
        let capacity = self.capacity();

        if self.len + 1 > capacity {
            Err(Error::Overflow(el))
        } else if self.is_reversed {
            let (mut start_index, is_overflowed) = self.start_index.overflowing_sub(1);
            if is_overflowed {
                start_index = capacity - 1;
            }

            self.start_index = start_index;
            self.inner[self.start_index] = el;
            self.len += 1;

            Ok(())
        } else {
            let index = self.wrap_raw_index(self.start_index + self.len);
            self.inner[index] = el;
            self.len += 1;

            Ok(())
        }
    }
/// Add new item at the end
/// Returns an error when the buffer is full
Add new item at the end
Returns an error when the buffer is full
Add new item at the end Returns an error when the buffer is full
pub fn try_push(&mut self, el: T) -> Result<T> {
        let capacity = self.capacity();
        if self.len + 1 > capacity {
            Err(Error::Overflow(el))
        } else if self.is_reversed {
            let (mut start_index, is_overflowed) = self.start_index.overflowing_sub(1);
            if is_overflowed {
                start_index = capacity - 1;
            }
            self.start_index = start_index;
            self.inner[self.start_index] = el;
            self.len += 1;
            Ok(())
        } else {
            let index = self.wrap_raw_index(self.start_index + self.len);
            self.inner[index] = el;
            self.len += 1;
            Ok(())
        }
    }
pub fn try_push ( & mut self , el : T ) -> Result < T > { let capacity = self . capacity ( ) ; if self . len + 1 > capacity { Err ( Error :: Overflow ( el ) ) } else if self . is_reversed { let ( mut start_index , is_overflowed ) = self . start_index . overflowing_sub ( 1 ) ; if is_overflowed { start_index = capacity - 1 ; } self . start_index = start_index ; self . inner [ self . start_index ] = el ; self . len += 1 ; Ok ( ( ) ) } else { let index = self . wrap_raw_index ( self . start_index + self . len ) ; self . inner [ index ] = el ; self . len += 1 ; Ok ( ( ) ) } }
Add new item at the end
Returns an error when the buffer is full
Add new item at the end Returns an error when the buffer is full
&mut self
el
T