pub fn push_front(&mut self, element: A::Item) -> Option<A::Item> {
        let existing = if self.is_full() {
            if self.capacity() == 0 {
                return Some(element);
            } else {
                self.pop_back()
            }
        } else {
            None
        };

        unsafe {
            self.push_front_unchecked(element);
        }

        existing
    }
/// Add an element to the front of the deque.
///
/// Return `None` if deque still has capacity, or `Some(existing)`
/// if the deque is full, where `existing` is the backmost element being kicked out.
///
/// # Examples
///
/// ```
/// // 1 -(+)-> [_, _, _] => [1, _, _] -> None
/// // 2 -(+)-> [1, _, _] => [2, 1, _] -> None
/// // 3 -(+)-> [2, 1, _] => [3, 2, 1] -> None
/// // 4 -(+)-> [3, 2, 1] => [4, 3, 2] -> Some(1)
///
/// use arraydeque::{ArrayDeque, Wrapping};
///
/// let mut buf: ArrayDeque<[_; 3], Wrapping> = ArrayDeque::new();
///
/// buf.push_front(1);
/// buf.push_front(2);
/// buf.push_front(3);
///
/// let existing = buf.push_front(4);
///
/// assert_eq!(existing, Some(1));
/// assert_eq!(buf.back(), Some(&2));
/// ```
Add an element to the front of the deque.
Add an element to the front of the deque .
pub fn push_front(&mut self, element: A::Item) -> Option<A::Item> {
        let existing = if self.is_full() {
            if self.capacity() == 0 {
                return Some(element);
            } else {
                self.pop_back()
            }
        } else {
            None
        };
        unsafe {
            self.push_front_unchecked(element);
        }
        existing
    }
pub fn push_front ( & mut self , element : A :: Item ) -> Option < A :: Item > { let existing = if self . is_full ( ) { if self . capacity ( ) == 0 { return Some ( element ) ; } else { self . pop_back ( ) } } else { None } ; unsafe { self . push_front_unchecked ( element ) ; } existing }
Add an element to the front of the deque.
Add an element to the front of the deque .
&mut self
element
A::Item
examples


use arraydeque::{ArrayDeque, Wrapping}.

let mut buf: ArrayDeque<[_; 3], Wrapping> = ArrayDeque::new().



let existing = buf.push_front(4).


use arraydeque :: { ArrayDeque Wrapping } . let mut buf : ArrayDeque< [ _ ; 3 ] Wrapping > = ArrayDeque :: new () . let existing = buf . push_front ( 4 ) .