zng/
progress.rs

1#![cfg(feature = "progress")]
2
3//! Progress indicator widget, styles and properties.
4//!
5//! This widget displays [`task::Progress`] values that track the status of a running task.
6//!
7//! ```
8//! use zng::prelude::*;
9//!
10//! let p = var(task::Progress::indeterminate());
11//!
12//! // on the view
13//! let view = zng::progress::ProgressView!(p.clone());
14//!
15//! // on the controller/view-model
16//! task::spawn(async move {
17//!     for n in 0..=10 {
18//!         task::deadline(500.ms()).await;
19//!         p.set(task::Progress::from_n_of(n, 10).with_msg(formatx!("sleeping {n} of 10")));
20//!     }
21//!     p.set(task::Progress::complete().with_msg("done sleeping"));
22//! });
23//! ```
24//!
25//! [`task::Progress`]: zng::task::Progress
26//!
27//! # Full API
28//!
29//! See [`zng_wgt_progress`] and [`zng_task::Progress`] for the full widget API.
30
31pub use zng_wgt_progress::{DefaultStyle, PROGRESS_VAR, ProgressView, SimpleBarStyle, is_indeterminate, on_complete, on_progress};