pub(crate) struct Rx<T> {
head: NonNull<Block<T>>,
index: usize,
free_head: NonNull<Block<T>>,
}
Expand description
List queue receive handle
Fields§
§head: NonNull<Block<T>>
Pointer to the block being processed.
index: usize
Next slot index to process.
free_head: NonNull<Block<T>>
Pointer to the next block pending release.
Implementations§
source§impl<T> Rx<T>
impl<T> Rx<T>
pub(crate) fn is_empty(&self, tx: &Tx<T>) -> bool
pub(crate) fn len(&self, tx: &Tx<T>) -> usize
sourcepub(crate) fn try_pop(&mut self, tx: &Tx<T>) -> TryPopResult<T>
pub(crate) fn try_pop(&mut self, tx: &Tx<T>) -> TryPopResult<T>
Pops the next value off the queue, detecting whether the block is busy or empty on failure.
This function exists because Rx::pop
can return None
even if the
channel’s queue contains a message that has been completely written.
This can happen if the fully delivered message is behind another message
that is in the middle of being written to the block, since the channel
can’t return the messages out of order.
sourcefn try_advancing_head(&mut self) -> bool
fn try_advancing_head(&mut self) -> bool
Tries advancing the block pointer to the block referenced by self.index
.
Returns true
if successful, false
if there is no next block to load.
fn reclaim_blocks(&mut self, tx: &Tx<T>)
sourcepub(super) unsafe fn free_blocks(&mut self)
pub(super) unsafe fn free_blocks(&mut self)
Effectively Drop
all the blocks. Should only be called once, when
the list is dropping.