Module zng::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§

  • W Progress view default style (progress bar with message text).
  • W Progress indicator widget.
  • W Progress view style that is only the progress bar, no message text.

Statics§

Functions§

  • P Getter property that is true when progress is indeterminate.
  • P Event raised when progress updates to a complete state or inits completed.
  • P Event raised for each progress update, and once after info init.