Module progress

Module progress 

Source
Expand description

Progress indicator widget, styles and properties.

This widget displays task::Progress values that track the status of a running task.

use zng::prelude::*;

let p = var(task::Progress::indeterminate());

// on the view
let view = zng::progress::ProgressView!(p.clone());

// on the controller/view-model
task::spawn(async move {
    for n in 0..=10 {
        task::deadline(500.ms()).await;
        p.set(task::Progress::from_n_of(n, 10).with_msg(formatx!("sleeping {n} of 10")));
    }
    p.set(task::Progress::complete().with_msg("done sleeping"));
});

§Full API

See zng_wgt_progress and zng_task::Progress for the full widget API.

Structs§

CircularStyle
W Circular progress indicator style.
DefaultStyle
W Progress view default style (progress bar with message text).
ProgressView
W Progress indicator widget.
SimpleBarStyle
W Progress view style that is only the progress bar, no message text.
SimpleCircularStyle
W Circular progress indicator style without message text.

Statics§

PROGRESS_VAR
The progress status value in a ProgressView

Functions§

circular_style_fn
P Extends or replaces the CircularStyle!.
is_indeterminate
P Getter property that is true when progress is indeterminate.
on_complete
P Event raised when progress updates to a complete state or inits completed.
on_progress
P Event raised for each progress update, and once after info init.
simple_bar_style_fn
P Extends or replaces the SimpleBarStyle!.
simple_circular_style_fn
P Extends or replaces the SimpleCircularStyle!.