Skip to content

Commit

Permalink
Add Sync bound to ProgressTracker
Browse files Browse the repository at this point in the history
  • Loading branch information
djc committed Aug 18, 2022
1 parent 217291a commit 9f424a4
Showing 1 changed file with 5 additions and 2 deletions.
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

0 comments on commit 9f424a4

Please sign in to comment.