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//! # fn demo() {
9//! use zng::prelude::*;
10//!
11//! let p = var(task::Progress::indeterminate());
12//!
13//! // on the view
14//! let view = zng::progress::ProgressView!(p.clone());
15//!
16//! // on the controller/view-model
17//! task::spawn(async move {
18//!     for n in 0..=10 {
19//!         task::deadline(500.ms()).await;
20//!         p.set(task::Progress::from_n_of(n, 10).with_msg(formatx!("sleeping {n} of 10")));
21//!     }
22//!     p.set(task::Progress::complete().with_msg("done sleeping"));
23//! });
24//! # }
25//! ```
26//!
27//! [`task::Progress`]: zng::task::Progress
28//!
29//! # Full API
30//!
31//! See [`zng_wgt_progress`] and [`zng_task::Progress`] for the full widget API.
32
33pub use zng_wgt_progress::{
34    CircularStyle, DefaultStyle, PROGRESS_VAR, ProgressView, SimpleBarStyle, SimpleCircularStyle, circular_style_fn, is_indeterminate,
35    on_complete, on_progress, simple_bar_style_fn, simple_circular_style_fn,
36};