Skip to main content

ProgressLogger

Struct ProgressLogger 

Source
pub struct ProgressLogger { /* private fields */ }
Expand description

Logs progress every N records.

Designed for high-throughput loops where millions of items are processed. The counter is checked against a pre-computed milestone to avoid a division on every call; only when the milestone is reached does the logger perform any formatting or I/O.

Implementations§

Source§

impl ProgressLogger

Source

pub fn new(name: &'static str, unit: &'static str, every: u64) -> Self

Creates a new progress logger.

  • name — log target (appears in [target] in log output)
  • unit — label for items being counted (e.g. "reads", "records")
  • every — emit a progress line every N items
Source

pub fn record(&mut self)

Record one item and log if the interval has been reached.

Source

pub fn record_n(&mut self, n: u64)

Advance the counter by n and emit a progress message if a milestone boundary is crossed. If n spans multiple milestones only one message is emitted.

Source

pub fn finish(&self)

Log final totals.

Auto Trait Implementations§

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.