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

Add Sync bound to ProgressTracker #471

Merged
merged 1 commit into from Aug 18, 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
7 changes: 5 additions & 2 deletions src/style.rs
Expand Up @@ -709,7 +709,7 @@ enum Alignment {
}

/// Trait for defining stateful or stateless formatters
pub trait ProgressTracker: Send {
pub trait ProgressTracker: Send + Sync {
/// Creates a new instance of the progress tracker
fn clone_box(&self) -> Box<dyn ProgressTracker>;
/// Notifies the progress tracker of a tick event
Expand All @@ -726,7 +726,10 @@ impl Clone for Box<dyn ProgressTracker> {
}
}

impl<F: Fn(&ProgressState, &mut dyn fmt::Write) + Send + Clone + 'static> ProgressTracker for F {
impl<F> ProgressTracker for F
where
F: Fn(&ProgressState, &mut dyn fmt::Write) + Send + Sync + Clone + 'static,
{
fn clone_box(&self) -> Box<dyn ProgressTracker> {
Box::new(self.clone())
}
Expand Down