Skip to content

Commit

Permalink
Document last char/string in tick style being the "final" state
Browse files Browse the repository at this point in the history
The last item in tick chars/strings won't ever show unless a progress
bar is finalized.  This also self-clarifies the requirement for at least
two chars/strings.
  • Loading branch information
MarijnS95 authored and djc committed Sep 8, 2022
1 parent a466096 commit b9dcd47
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/style.rs
Expand Up @@ -101,6 +101,9 @@ impl ProgressStyle {
}

/// Sets the tick character sequence for spinners
///
/// Note that the last character is used as the [final tick string][Self::get_final_tick_str()].
/// At least two characters are required to provide a non-final and final state.
pub fn tick_chars(mut self, s: &str) -> ProgressStyle {
self.tick_strings = s.chars().map(|c| c.to_string().into()).collect();
// Format bar will panic with some potentially confusing message, better to panic here
Expand All @@ -113,6 +116,9 @@ impl ProgressStyle {
}

/// Sets the tick string sequence for spinners
///
/// Note that the last string is used as the [final tick string][Self::get_final_tick_str()].
/// At least two strings are required to provide a non-final and final state.
pub fn tick_strings(mut self, s: &[&str]) -> ProgressStyle {
self.tick_strings = s.iter().map(|s| s.to_string().into()).collect();
// Format bar will panic with some potentially confusing message, better to panic here
Expand Down

0 comments on commit b9dcd47

Please sign in to comment.