Returns the number of items currently in the queue.
(&self)
| 204 | |
| 205 | /// Returns the number of items currently in the queue. |
| 206 | pub fn len(&self) -> usize { |
| 207 | let tail = self.shared.tail.value.load(Ordering::Relaxed); |
| 208 | let head = self.shared.head.value.load(Ordering::Relaxed); |
| 209 | tail.wrapping_sub(head) as usize |
| 210 | } |
| 211 | |
| 212 | /// Returns `true` if the queue is empty. |
| 213 | pub fn is_empty(&self) -> bool { |