Receiver

Struct Receiver 

Source
pub struct Receiver<T, const P: usize, const NUM_SEGS_P2: usize> { /* private fields */ }

Implementations§

Source§

impl<T, const P: usize, const NUM_SEGS_P2: usize> Receiver<T, P, NUM_SEGS_P2>

Source

pub fn next(&mut self) -> u64

Source

pub fn is_closed(&self) -> bool

Check if the queue is closed

Source

pub fn close(&self) -> bool

Close the queue

After closing, no more items can be pushed. This method will block until all SPSC queues are empty. Wakes any waiting consumer.

Note: This waits for consumer to drain all items from all producer queues.

Source

pub fn producer_count(&self) -> usize

Get the number of registered producers

Source

pub fn create_sender(&self) -> Result<Sender<T, P, NUM_SEGS_P2>, PushError<()>>

Source

pub fn create_sender_with_config( &self, max_pooled_segments: usize, ) -> Result<Sender<T, P, NUM_SEGS_P2>, PushError<()>>

Create a new producer handle that bypasses all thread-local caching

This creates a direct, high-performance handle to a specific producer queue. The handle provides push-only access without any thread-local overhead, making it ideal for scenarios where you need maximum performance and want to maintain explicit control over producer instances.

Unlike get_producer_queue(), this method:

  • Does not register with thread-local storage
  • Does not use caching mechanisms
  • Provides a standalone handle that can be stored and reused
  • Offers maximum push performance
§Returns

Returns a ProducerHandle that can be used to push values, or PushError::Closed if the MPSC queue is closed.

§Example
let mpsc = MpscBlocking::<i32, 64>::new();

// Create a direct producer handle
let producer = mpsc.create_producer_handle().unwrap();

// Use the handle for high-performance pushes
producer.push(42).unwrap();
producer.push_bulk(&[1, 2, 3]).unwrap();
```ignore
Source

pub fn try_pop(&mut self) -> Result<T, PopError>

Pop a value from the queue (non-blocking) using supplied Selector

Returns immediately with Empty if no items are available.

§Safety

This method may not be called concurrently from multiple threads.

Source

pub fn try_pop_n(&mut self, batch: &mut [T]) -> usize

Source

pub fn try_pop_with_id(&mut self) -> Result<(T, usize), PopError>

Attempts to pop a single value and returns the item along with the producer id.

Trait Implementations§

Source§

impl<T, const P: usize, const NUM_SEGS_P2: usize> Drop for Receiver<T, P, NUM_SEGS_P2>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<T: Send, const P: usize, const NUM_SEGS_P2: usize> Send for Receiver<T, P, NUM_SEGS_P2>

Auto Trait Implementations§

§

impl<T, const P: usize, const NUM_SEGS_P2: usize> Freeze for Receiver<T, P, NUM_SEGS_P2>

§

impl<T, const P: usize, const NUM_SEGS_P2: usize> RefUnwindSafe for Receiver<T, P, NUM_SEGS_P2>

§

impl<T, const P: usize, const NUM_SEGS_P2: usize> Sync for Receiver<T, P, NUM_SEGS_P2>

§

impl<T, const P: usize, const NUM_SEGS_P2: usize> Unpin for Receiver<T, P, NUM_SEGS_P2>

§

impl<T, const P: usize, const NUM_SEGS_P2: usize> UnwindSafe for Receiver<T, P, NUM_SEGS_P2>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V