pub struct LogIterator { /* private fields */ }Expand description
An iterator over a Data file.
The LogIterator acts as an active reader over the log, pulling messages from the log
and decoding them, while maintaining a cursor to ensure that superflous reads are not performed
when a read limit is provided via end_position.
Implementations§
Source§impl LogIterator
impl LogIterator
Sourcepub fn new(reader: BufReader<File>, cursor: u64, end_position: u64) -> Self
pub fn new(reader: BufReader<File>, cursor: u64, end_position: u64) -> Self
Constructs a new LogIterator instance.
Sourcepub async fn next(&mut self) -> Result<Option<Message>>
pub async fn next(&mut self) -> Result<Option<Message>>
Attempts to decode and retrieve the next message from the reader.
Returns Option::None if there are no more messages to decode.
§Errors
Returns std::io::ErrorKind::UnexpectedEof if the an unexpected end-of-file is encountered due to a partially committed or corrupted message.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for LogIterator
impl !RefUnwindSafe for LogIterator
impl Send for LogIterator
impl Sync for LogIterator
impl Unpin for LogIterator
impl UnwindSafe for LogIterator
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