Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document last char/string in tick style being the "final" state #479

Merged
merged 1 commit into from Sep 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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