Skip to main content

FormattedProgressReporter

Struct FormattedProgressReporter 

Source
pub struct FormattedProgressReporter<F, C> { /* private fields */ }
Expand description

Progress reporter that formats each metric snapshot and sends it to a consumer.

This reporter is the common adapter behind text and JSON progress reporters. It converts every counter in an event into a metric snapshot, formats the snapshot, then passes the formatted string to the configured consumer.

Implementations§

Source§

impl<F, C> FormattedProgressReporter<F, C>

Source

pub const fn new(formatter: F, consumer: C) -> Self

Creates a formatted progress reporter.

§Parameters
  • formatter - Formatter applied to each metric snapshot.
  • consumer - Consumer receiving formatted strings.
§Returns

A reporter that formats metric snapshots and sends strings to consumer.

Source

pub const fn formatter(&self) -> &F

Returns the configured formatter.

§Returns

A shared reference to the metric snapshot formatter.

Source

pub const fn consumer(&self) -> &C

Returns the configured consumer.

§Returns

A shared reference to the formatted string consumer.

Trait Implementations§

Source§

impl<F, C> ProgressReporter for FormattedProgressReporter<F, C>

Source§

fn report(&self, event: &ProgressEvent)

Formats and consumes every metric snapshot in an event.

§Parameters
  • event - Event whose metric snapshots should be formatted.

Auto Trait Implementations§

§

impl<F, C> Freeze for FormattedProgressReporter<F, C>
where F: Freeze, C: Freeze,

§

impl<F, C> RefUnwindSafe for FormattedProgressReporter<F, C>

§

impl<F, C> Send for FormattedProgressReporter<F, C>
where F: Send, C: Send,

§

impl<F, C> Sync for FormattedProgressReporter<F, C>
where F: Sync, C: Sync,

§

impl<F, C> Unpin for FormattedProgressReporter<F, C>
where F: Unpin, C: Unpin,

§

impl<F, C> UnsafeUnpin for FormattedProgressReporter<F, C>
where F: UnsafeUnpin, C: UnsafeUnpin,

§

impl<F, C> UnwindSafe for FormattedProgressReporter<F, C>
where F: UnwindSafe, C: UnwindSafe,

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.