Skip to main content

BinlogReader

Struct BinlogReader 

Source
pub struct BinlogReader<R: Read> { /* private fields */ }
Expand description

Sequential reader over a .binlog stream.

Opens the binlog header, decompresses the GZip body, and yields typed BinlogEvent values one at a time via next_event.

Auxiliary records (string table entries, name-value lists, embedded archives) are ingested automatically and are accessible through the corresponding accessor methods.

Implementations§

Source§

impl<R: Read> BinlogReader<R>

Source

pub fn open(reader: R) -> Result<Self, MuninError>

Open a binlog stream and prepare for sequential reading.

Reads the uncompressed header, validates the format version, and sets up GZip decompression for the record body.

Source

pub fn header(&self) -> &BinlogHeader

The parsed binlog file header.

Source

pub fn strings(&self) -> &StringTable

The string table accumulated so far.

Source

pub fn nvl_table(&self) -> &NameValueListTable

The name-value list table accumulated so far.

Source

pub fn archives(&self) -> &[Vec<u8>]

Embedded zip archives read from ProjectImportArchive records.

Source

pub fn extract_archives(&self) -> Result<Vec<ArchiveEntry>, MuninError>

Extract all files from all embedded ProjectImportArchive zip archives.

Returns a list of (path, contents) pairs. Paths are as stored in the zip (typically relative project file paths). If a zip entry cannot be read (e.g. unsupported compression), that entry is silently skipped.

Source

pub fn next_event(&mut self) -> Result<Option<BinlogEvent>, MuninError>

Read the next build event from the stream.

Returns Ok(None) when the EndOfFile record is reached.

Auxiliary records (String, NameValueList, ProjectImportArchive) are ingested internally and do not produce events. Unknown record kinds are silently skipped (forward-compatibility).

Source

pub fn read_all_events(&mut self) -> Result<Vec<BinlogEvent>, MuninError>

Collect all remaining events into a Vec.

Reads events until EndOfFile is reached. Auxiliary records are ingested along the way.

Trait Implementations§

Source§

impl<R: Debug + Read> Debug for BinlogReader<R>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<R> !RefUnwindSafe for BinlogReader<R>

§

impl<R> !UnwindSafe for BinlogReader<R>

§

impl<R> Freeze for BinlogReader<R>
where R: Freeze,

§

impl<R> Send for BinlogReader<R>
where R: Send,

§

impl<R> Sync for BinlogReader<R>
where R: Sync,

§

impl<R> Unpin for BinlogReader<R>
where R: Unpin,

§

impl<R> UnsafeUnpin for BinlogReader<R>
where R: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.