Skip to content

Commit

Permalink
Mention the prefix and message placeholders in the with_ docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lnicola authored and chris-laplante committed Apr 7, 2023
1 parent 2b02626 commit 4987fc5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/progress_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ impl ProgressBar {
}

/// A convenience builder-like function for a progress bar with a given prefix
///
/// For the prefix to be visible, the `{prefix}` placeholder must be present in the template
/// (see [`ProgressStyle`]).
pub fn with_prefix(self, prefix: impl Into<Cow<'static, str>>) -> Self {
let mut state = self.state();
state.state.prefix = TabExpandedString::new(prefix.into(), state.tab_width);
Expand All @@ -88,6 +91,9 @@ impl ProgressBar {
}

/// A convenience builder-like function for a progress bar with a given message
///
/// For the message to be visible, the `{msg}` placeholder must be present in the template (see
/// [`ProgressStyle`]).
pub fn with_message(self, message: impl Into<Cow<'static, str>>) -> Self {
let mut state = self.state();
state.state.message = TabExpandedString::new(message.into(), state.tab_width);
Expand Down

0 comments on commit 4987fc5

Please sign in to comment.