From 9f424a468c0f96b123b35483c77a87bfa3c9c811 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Thu, 18 Aug 2022 14:00:14 +0200 Subject: [PATCH] Add Sync bound to ProgressTracker --- src/style.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/style.rs b/src/style.rs index 05f56c43..a28d0807 100644 --- a/src/style.rs +++ b/src/style.rs @@ -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; /// Notifies the progress tracker of a tick event @@ -726,7 +726,10 @@ impl Clone for Box { } } -impl ProgressTracker for F { +impl ProgressTracker for F +where + F: Fn(&ProgressState, &mut dyn fmt::Write) + Send + Sync + Clone + 'static, +{ fn clone_box(&self) -> Box { Box::new(self.clone()) }