pub enum ReadResult<T> {
Value(T),
Empty,
Lapped {
skipped: usize,
},
}Available on non-crate feature
tests_loom only.Expand description
Outcome of a Consumer::try_read call.
try_read is non-blocking and never allocates, so the return value
distinguishes three cases the caller must handle: a successful read, an
empty queue, or a detected lap. The enum is #[must_use] because
silently dropping Value would lose the only copy of the data, and
silently dropping Lapped would hide message loss.
Variants§
Value(T)
A value was successfully read from the next slot.
Empty
The queue is currently empty.
Lapped
The producer lapped this consumer at least once. The read cursor has
been advanced to the most recently published slot; skipped is the
number of values that were never observed.
Trait Implementations§
Source§impl<T: Clone> Clone for ReadResult<T>
impl<T: Clone> Clone for ReadResult<T>
Source§fn clone(&self) -> ReadResult<T>
fn clone(&self) -> ReadResult<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<T: Copy> Copy for ReadResult<T>
Source§impl<T: Debug> Debug for ReadResult<T>
impl<T: Debug> Debug for ReadResult<T>
impl<T: Eq> Eq for ReadResult<T>
Source§impl<T: PartialEq> PartialEq for ReadResult<T>
impl<T: PartialEq> PartialEq for ReadResult<T>
impl<T: PartialEq> StructuralPartialEq for ReadResult<T>
Auto Trait Implementations§
impl<T> Freeze for ReadResult<T>where
T: Freeze,
impl<T> RefUnwindSafe for ReadResult<T>where
T: RefUnwindSafe,
impl<T> Send for ReadResult<T>where
T: Send,
impl<T> Sync for ReadResult<T>where
T: Sync,
impl<T> Unpin for ReadResult<T>where
T: Unpin,
impl<T> UnsafeUnpin for ReadResult<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for ReadResult<T>where
T: UnwindSafe,
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