pub struct PositionMonitor<T: 'static> { /* private fields */ }
Expand description
PositionMonitor<T>
records the current read/write positions of a queue.
The PositionMonitor
works by keeping track how many times the ring buffer wrapped around,
and the current offsets that are used.
The former (how many times the ring buffer wrapped around) is kept in an AtomicU64
that is updated each time a value is read.
The latter (current offsets) is kept by looking at the Fifo
directly.
Even though a queue is comprised of a limited number of slots arranged as a ring buffer, we can assign a position to each value written/ read to/from the queue. This is useful in case we want to know whether or not a particular value written to the queue has been read.
Implementations§
Source§impl<T> PositionMonitor<T>
impl<T> PositionMonitor<T>
pub fn read_position(&self) -> ReadPosition
pub fn write_position(&self) -> WritePosition
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for PositionMonitor<T>
impl<T> !RefUnwindSafe for PositionMonitor<T>
impl<T> !Send for PositionMonitor<T>
impl<T> !Sync for PositionMonitor<T>
impl<T> Unpin for PositionMonitor<T>
impl<T> !UnwindSafe for PositionMonitor<T>
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