gix_ref::file::log::iter

Function reverse

source
pub fn reverse<F>(log: F, buf: &mut [u8]) -> Result<Reverse<'_, F>>
where F: Read + Seek,
Expand description

An iterator over entries of the log file in reverse, using buf as sliding window.

Note that buf must be big enough to capture typical line length or else partial lines will be parsed and probably fail in the process.

This iterator is very expensive in terms of I/O operations and shouldn’t be used to read more than the last few entries of the log. Use a forward iterator instead for these cases.

It will continue parsing even if individual log entries failed to parse, leaving it to the driver to decide whether to abort or continue.