Skip to content

Commit

Permalink
doc: updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ishaan26 committed Sep 30, 2024
1 parent f9f3968 commit 983d8cd
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions zung_mini/src/progbar/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
//! ```rust
//! use zung_mini::progbar::ProgBarExt;
//!
//! let progbar = (0..10).progbar().bar_style("=").with_bounds('<', '>');
//! let progbar = (0..10).progbar().with_bounds('<', '>').bar_style("=");
//! for _ in progbar {
//! // Perform work
//! }
Expand Down Expand Up @@ -151,6 +151,26 @@ impl<T> ProgBar<T, UnBounded> {
}
}

/// Sets a custom message to display alongside the progress bar.
///
/// This method allows you to specify a custom message that will be displayed
/// with each update of the progress bar. This can be useful for providing
/// additional context or information while tracking progress.
///
/// **Note:** This method is only applicable to unbounded iterators, which do
/// not have a defined end. The message will appear each time the progress is
/// displayed.
///
/// # Example
///
/// ```rust
/// use zung_mini::progbar::ProgBarExt;
///
/// for _ in (0..).progbar().with_message("Processing...".to_string()) {
/// // Perform work here
/// # break;
/// };
/// ```
pub fn with_message(mut self, msg: String) -> Self {
self.message = msg;
self
Expand Down Expand Up @@ -285,15 +305,15 @@ where
///
/// (0..100)
/// .progbar()
/// .bar_style(&String::from("="))
/// .with_bounds("|", "|")
/// .bar_style(&String::from("="))
/// .for_each(|_| {
/// // Do some calculation
/// });
///
/// // or
///
/// for _ in (0..).progbar().bar_style(&"<>") {
/// for _ in (0..).progbar() {
/// // Do some calculation
/// }
///
Expand Down Expand Up @@ -365,7 +385,7 @@ where
/// ```rust
/// use zung_mini::progbar::ProgBarExt;
///
/// let progbar = (0..10).progbar().bar_style("=").with_bounds('<', '>');
/// let progbar = (0..10).progbar().with_bounds('<', '>').bar_style("=");
/// for _ in progbar {
/// // Simulate some work
/// }
Expand Down

0 comments on commit 983d8cd

Please sign in to comment.