use qubit_function::{
ArcConsumer,
Consumer,
};
use super::formatted_progress_reporter::FormattedProgressReporter;
use crate::{
model::ProgressEvent,
reporter::{
ProgressReporter,
format::HumanReadableMetricSnapshotFormatter,
},
};
pub struct HumanReadableProgressReporter<C = ArcConsumer<String>> {
inner: FormattedProgressReporter<HumanReadableMetricSnapshotFormatter, C>,
}
impl<C> HumanReadableProgressReporter<C> {
#[inline]
pub fn new(consumer: C) -> Self {
Self {
inner: FormattedProgressReporter::new(HumanReadableMetricSnapshotFormatter::new(), consumer),
}
}
#[inline]
pub const fn inner(&self) -> &FormattedProgressReporter<HumanReadableMetricSnapshotFormatter, C> {
&self.inner
}
}
impl<C> ProgressReporter for HumanReadableProgressReporter<C>
where
C: Consumer<String> + Send + Sync,
{
#[inline]
fn report(&self, event: &ProgressEvent) {
self.inner.report(event);
}
}