pub struct Consumer<T, const CAPACITY: usize, A>where
A: Allocator,{ /* private fields */ }Expand description
Implementations§
Source§impl<T, const CAPACITY: usize, A> Consumer<T, CAPACITY, A>where
A: Allocator,
impl<T, const CAPACITY: usize, A> Consumer<T, CAPACITY, A>where
A: Allocator,
Sourcepub fn pop(&mut self) -> Option<T>
pub fn pop(&mut self) -> Option<T>
Pops the next item from the queue.
Wait-free. Returns Some(item) on success, None if the queue is
currently empty.
§Examples
use low_latency_data_structures::spsc::{self, new};
use low_latency_data_structures::mem::global::GlobalAllocator;
let (mut producer, mut consumer) = new::<u64, 4, GlobalAllocator>(
spsc::Options::global_mlocked(),
);
assert_eq!(consumer.pop(), None);
let _ = producer.push(42);
assert_eq!(consumer.pop(), Some(42));Trait Implementations§
impl<T, const CAPACITY: usize, A> Send for Consumer<T, CAPACITY, A>
Auto Trait Implementations§
impl<T, const CAPACITY: usize, A> !RefUnwindSafe for Consumer<T, CAPACITY, A>
impl<T, const CAPACITY: usize, A> !Sync for Consumer<T, CAPACITY, A>
impl<T, const CAPACITY: usize, A> !UnwindSafe for Consumer<T, CAPACITY, A>
impl<T, const CAPACITY: usize, A> Freeze for Consumer<T, CAPACITY, A>
impl<T, const CAPACITY: usize, A> Unpin for Consumer<T, CAPACITY, A>
impl<T, const CAPACITY: usize, A> UnsafeUnpin for Consumer<T, CAPACITY, A>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more