howudoin/consumers/
mod.rs

1//! Predefined implementors of [`Consume`].
2//!
3//! Consumers are feature gated.
4use super::*;
5
6/// A terminal line progress display. Requires `term-line` feature.
7#[cfg(feature = "term-line")]
8pub mod term_line;
9#[cfg(feature = "term-line")]
10pub use term_line::TermLine;
11
12/// Prints progress tree as JSON to stdout. Requires `json-printer` feature.
13#[cfg(feature = "json-printer")]
14pub mod json_printer;
15#[cfg(feature = "json-printer")]
16pub use json_printer::JsonPrinter;
17
18/// A consumer that does not do anything.
19///
20/// The inner duration is the debounce duration.
21/// This consumer is useful for accumulating progress messages and fetching them at a
22/// later time.
23pub struct Noop(pub Duration);
24
25impl Default for Noop {
26    fn default() -> Self {
27        Noop(Duration::from_millis(50))
28    }
29}
30
31impl Consume for Noop {
32    fn debounce(&self) -> Duration {
33        self.0
34    }
35
36    fn rpt(&mut self, _: &report::Report, _: Id, _: Option<Id>, _: &Controller) {}
37}