pub trait Consume {
// Required method
fn rpt(
&mut self,
report: &Report,
id: Id,
parent: Option<Id>,
controller: &Controller,
);
// Provided methods
fn debounce(&self) -> Duration { ... }
fn closed(&mut self, _id: Id) { ... }
}
Expand description
A report consumer.
A consumer is required when initialising progress reporting.
They can be defined on local types, and there are a few predined consumers in the consumers
module.
When defining a consumer, it is recommended to take a look at the predefined ones and the examples.
Note that a consumer is invoked. If a requester of progress is required, fetch
should
be used.
Required Methods§
Sourcefn rpt(
&mut self,
report: &Report,
id: Id,
parent: Option<Id>,
controller: &Controller,
)
fn rpt( &mut self, report: &Report, id: Id, parent: Option<Id>, controller: &Controller, )
Invoked when reports are updated in some way.
rpt
is only invoked if there have been changes, and after Consume::debounce
.
The report
has the meat of the progress, while there are identifiers to see where the
report lands in the tree.
Provided Methods§
Sourcefn debounce(&self) -> Duration
fn debounce(&self) -> Duration
Set the debounce timeout.
Defaults to 50 milliseconds.
This is the time waited for before invoking the Consume::rpt
or Consume::closed
.
The debounce allows reports to be fully updated before being displayed, avoiding flogging
the consumer.