From 889084fa3a1b7c1942a4a9073d7c1547942c0b7b Mon Sep 17 00:00:00 2001 From: Chris Laplante <40474653+chris-laplante@users.noreply.github.com> Date: Wed, 27 Sep 2023 10:55:52 -0400 Subject: [PATCH] improve documentation for usage as spinner (#593) --- src/lib.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 6902ef69..5dc3ff84 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -56,6 +56,19 @@ //! bar.finish(); //! ``` //! +//! Spinners can be manually advanced with `tick`, or you can set them up to spin automatically with +//! `enable_steady_tick`: +//! +//! ```rust +//! use std::time::Duration; +//! use indicatif::ProgressBar; +//! +//! let bar = ProgressBar::new_spinner(); +//! bar.enable_steady_tick(Duration::from_millis(100)); +//! // ... do some work +//! bar.finish(); +//! ``` +//! //! General progress bar behaviors: //! //! * if a non terminal is detected the progress bar will be completely @@ -164,7 +177,8 @@ //! style is used for the bar that is yet to render. //! * `wide_bar`: like `bar` but always fills the remaining space. It should not be used with //! `wide_msg`. -//! * `spinner`: renders the spinner (current tick string). +//! * `spinner`: renders the spinner (current tick string). Note that spinners do not automatically tick by default. You either +//! need to call `enable_steady_tick` or manually call `tick`. //! * `prefix`: renders the prefix set on the progress bar. //! * `msg`: renders the currently set message on the progress bar. //! * `wide_msg`: like `msg` but always fills the remaining space and truncates. It should not be used