diff options
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 26 |
1 files changed, 14 insertions, 12 deletions
@@ -47,21 +47,21 @@ //! let verify_sha256_task = async { //! for i in 1..6 { //! sleep(Duration::from_millis(300)).await; -//! progress::update_progress("Download/Verify/SHA256", i as f32 * 0.2); +//! progress::update_progress(r"Download\/Verify\/SHA256", i as f32 * 0.2); //! } //! }; //! //! let verify_md5_task = async { //! for i in 1..6 { //! sleep(Duration::from_millis(100)).await; -//! progress::update_progress("Download/Verify/MD5", i as f32 * 0.2); +//! progress::update_progress(r"Download\/Verify\/MD5", i as f32 * 0.2); //! } //! }; //! //! let verify_blake3_task = async { //! for i in 1..6 { //! sleep(Duration::from_millis(500)).await; -//! progress::update_progress("Download/Verify/Blake3", i as f32 * 0.2); +//! progress::update_progress(r"Download\/Verify\/Blake3", i as f32 * 0.2); //! } //! }; //! @@ -110,17 +110,17 @@ /// ```rust /// # use just_progress::progress::{self, ProgressInfo}; /// // Update progress value -/// progress::update_progress("download/file1", 0.5); +/// progress::update_progress(r"download\/file1", 0.5); /// /// // Update status information -/// progress::update_info("download/file1", ProgressInfo::Info("Downloading...")); +/// progress::update_info(r"download\/file1", ProgressInfo::Info("Downloading...")); /// /// // Update both progress and status simultaneously -/// progress::update("download/file1", 0.75, ProgressInfo::Warning("Slow network")); +/// progress::update(r"download\/file1", 0.75, ProgressInfo::Warning("Slow network")); /// /// // Mark as complete /// // Equivalent to progress::update_progress("download/file1", 1.0); -/// progress::complete("download/file1"); +/// progress::complete(r"download\/file1"); /// /// // Clear all progress items /// progress::clear_all(); @@ -142,12 +142,14 @@ /// /// # Hierarchical Progress /// -/// Progress names can use slashes (`/`) to represent hierarchical relationships, e.g., `"parent/child"`. +/// Progress names can use backslash-slash (`\/`) to represent hierarchical relationships, e.g., `r"parent\/child"`. /// Renderers can leverage this structure to display indentation or calculate the average progress of parent tasks. +/// The `\/` separator is used instead of `/` to allow file paths to be used as progress names. /// /// # Notes /// /// - `init()` must be called before using any other functions. +/// - When using subprogress, use `\/` as the separator in progress names (e.g., `r"parent\/child"`). /// - The Future returned by `bind()` needs to be polled or awaited for callbacks to execute. /// - `clear_all()` sends a clear signal but does not immediately clear messages in the channel. /// - `close()` stops all `bind()` calls; progress updates are no longer possible afterward. @@ -187,10 +189,10 @@ pub mod progress; /// /// # Subprogress /// -/// When `subprogress` is enabled, progress names can be separated by slashes (`/`) to represent hierarchical relationships: -/// - `"parent"` - Top-level progress -/// - `"parent/child"` - Subprogress, automatically indented when displayed -/// - `"parent/child/grandchild"` - Deeper level progress +/// When `subprogress` is enabled, progress names can be separated by backslash-slash (`\/`) to represent hierarchical relationships: +/// - `r"parent"` - Top-level progress +/// - `r"parent\/child"` - Subprogress, automatically indented when displayed +/// - `r"parent\/child\/grandchild"` - Deeper level progress /// /// If a parent node does not have a directly corresponding progress state, the renderer will automatically calculate the average progress of its child nodes as the display value. /// |
