pub fn new(capacity: usize) -> Self {
        let mut elements = Vec::with_capacity(capacity);
        for _ in 0..capacity {
            elements.push(MaybeUninit::uninit());
        }
        let mut states = Vec::with_capacity(capacity);
        for _ in 0..capacity {
            states.push(AtomicI8::new(CellState::Empty.into()));
        }
        let head = AtomicUsize::new(0);
        let tail = AtomicUsize::new(0);
        Queue {
            head,
            tail,
            elements,
            states,
        }
    }
/// Create a queue with a certain capacity. Writes will fail when the queue is full.
Create a queue with a certain capacity. Writes will fail when the queue is full.
Create a queue with a certain capacity . Writes will fail when the queue is full .
pub fn new(capacity: usize) -> Self {
        let mut elements = Vec::with_capacity(capacity);
        for _ in 0..capacity {
            elements.push(MaybeUninit::uninit());
        }
        let mut states = Vec::with_capacity(capacity);
        for _ in 0..capacity {
            states.push(AtomicI8::new(CellState::Empty.into()));
        }
        let head = AtomicUsize::new(0);
        let tail = AtomicUsize::new(0);
        Queue {
            head,
            tail,
            elements,
            states,
        }
    }
pub fn new ( capacity : usize ) -> Self { let mut elements = Vec :: with_capacity ( capacity ) ; for _ in 0 .. capacity { elements . push ( MaybeUninit :: uninit ( ) ) ; } let mut states = Vec :: with_capacity ( capacity ) ; for _ in 0 .. capacity { states . push ( AtomicI8 :: new ( CellState :: Empty . into ( ) ) ) ; } let head = AtomicUsize :: new ( 0 ) ; let tail = AtomicUsize :: new ( 0 ) ; Queue { head , tail , elements , states , } }
Create a queue with a certain capacity.
Create a queue with a certain capacity .
capacity
usize
capacity
usize