/// Push an element into the queue and return `true` on success.
///
/// `false` will be returned if the queue is full. If there's contention this operation will
/// wait until it's able to claim a slot in the queue.
Push an element into the queue and return `true` on success.
`false` will be returned if the queue is full. If there's contention this operation will
wait until it's able to claim a slot in the queue.
Push an element into the queue and return ` true ` on success . ` false ` will be returned if the queue is full . If there ' s contention this operation will wait until it ' s able to claim a slot in the queue .
pub fn push(&self, element: T) -> bool {
        let mut head = self.head.load(Ordering::Relaxed);
        let elements_len = self.elements.len();
        loop {
            let length = head as i64 - self.tail.load(Ordering::Relaxed) as i64;
            if length >= elements_len as i64 {
                return false;
            }
            if self
                .head
                .compare_exchange(head, head + 1, Ordering::Acquire, Ordering::Relaxed)
                .is_ok()
            {
                self.do_push(element, head);
                return true;
            }
            head = self.head.load(Ordering::Relaxed);
        }
    }
pub fn push ( & self , element : T ) -> bool { let mut head = self . head . load ( Ordering :: Relaxed ) ; let elements_len = self . elements . len ( ) ; loop { let length = head as i64 - self . tail . load ( Ordering :: Relaxed ) as i64 ; if length >= elements_len as i64 { return false ; } if self . head . compare_exchange ( head , head + 1 , Ordering :: Acquire , Ordering :: Relaxed ) . is_ok ( ) { self . do_push ( element , head ) ; return true ; } head = self . head . load ( Ordering :: Relaxed ) ; } }
Push an element into the queue and return `true` on success.
Push an element into the queue and return ` true ` on success .
&self
element
T