pub struct Reader { /* private fields */ }Expand description
Wraps RingBuffer and allows to receive messages. Multiple readers can be present at any time,
they operate independently and are not part of any congestion control flow. As a result, each reader
can be overrun by the producer if it’s unable to keep up.
Implementations§
Source§impl Reader
impl Reader
Sourcepub fn metadata(&self) -> &'static [u8] ⓘ
pub fn metadata(&self) -> &'static [u8] ⓘ
Get metadata buffer associated with the underlying ring buffer.
Sourcepub fn with_initial_position(self, position: usize) -> Self
pub fn with_initial_position(self, position: usize) -> Self
Set reader initial position (the default is producer current position).
Sourcepub fn reset(&self)
pub fn reset(&self)
Reset reader position to current producer position, for recovering from overrun.
Sourcepub fn read_batch(&self) -> Option<Batch<'_>>
pub fn read_batch(&self) -> Option<Batch<'_>>
Construct Batch object that can efficiently read multiple messages in a batch between
Reader current position and prevailing producer position. Returns None if there is
no new data to read.
Sourcepub fn receive_next(&self) -> Option<Result<Message>>
pub fn receive_next(&self) -> Option<Result<Message>>
Receive next pending message from the ring buffer.
Auto Trait Implementations§
impl !Freeze for Reader
impl !RefUnwindSafe for Reader
impl !Send for Reader
impl !Sync for Reader
impl Unpin for Reader
impl UnwindSafe for Reader
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