@@ -140,7 +140,7 @@ pub struct ThreadPoolBuilder<S = DefaultSpawn> {
140
140
panic_handler : Option < Box < PanicHandler > > ,
141
141
142
142
/// Closure to compute the name of a thread.
143
- get_thread_name : Option < Box < FnMut ( usize ) -> String > > ,
143
+ get_thread_name : Option < Box < dyn FnMut ( usize ) -> String > > ,
144
144
145
145
/// The stack size for the created worker threads
146
146
stack_size : Option < usize > ,
@@ -170,17 +170,17 @@ pub struct Configuration {
170
170
171
171
/// The type for a panic handling closure. Note that this same closure
172
172
/// may be invoked multiple times in parallel.
173
- type PanicHandler = Fn ( Box < Any + Send > ) + Send + Sync ;
173
+ type PanicHandler = dyn Fn ( Box < dyn Any + Send > ) + Send + Sync ;
174
174
175
175
/// The type for a closure that gets invoked when a thread starts. The
176
176
/// closure is passed the index of the thread on which it is invoked.
177
177
/// Note that this same closure may be invoked multiple times in parallel.
178
- type StartHandler = Fn ( usize ) + Send + Sync ;
178
+ type StartHandler = dyn Fn ( usize ) + Send + Sync ;
179
179
180
180
/// The type for a closure that gets invoked when a thread exits. The
181
181
/// closure is passed the index of the thread on which is is invoked.
182
182
/// Note that this same closure may be invoked multiple times in parallel.
183
- type ExitHandler = Fn ( usize ) + Send + Sync ;
183
+ type ExitHandler = dyn Fn ( usize ) + Send + Sync ;
184
184
185
185
// NB: We can't `#[derive(Default)]` because `S` is left ambiguous.
186
186
impl Default for ThreadPoolBuilder {
@@ -481,7 +481,7 @@ impl<S> ThreadPoolBuilder<S> {
481
481
/// in a call to `std::panic::catch_unwind()`.
482
482
pub fn panic_handler < H > ( mut self , panic_handler : H ) -> Self
483
483
where
484
- H : Fn ( Box < Any + Send > ) + Send + Sync + ' static ,
484
+ H : Fn ( Box < dyn Any + Send > ) + Send + Sync + ' static ,
485
485
{
486
486
self . panic_handler = Some ( Box :: new ( panic_handler) ) ;
487
487
self
@@ -585,7 +585,7 @@ impl Configuration {
585
585
}
586
586
587
587
/// Deprecated in favor of `ThreadPoolBuilder::build`.
588
- pub fn build ( self ) -> Result < ThreadPool , Box < Error + ' static > > {
588
+ pub fn build ( self ) -> Result < ThreadPool , Box < dyn Error + ' static > > {
589
589
self . builder . build ( ) . map_err ( Box :: from)
590
590
}
591
591
@@ -607,7 +607,7 @@ impl Configuration {
607
607
/// Deprecated in favor of `ThreadPoolBuilder::panic_handler`.
608
608
pub fn panic_handler < H > ( mut self , panic_handler : H ) -> Configuration
609
609
where
610
- H : Fn ( Box < Any + Send > ) + Send + Sync + ' static ,
610
+ H : Fn ( Box < dyn Any + Send > ) + Send + Sync + ' static ,
611
611
{
612
612
self . builder = self . builder . panic_handler ( panic_handler) ;
613
613
self
@@ -678,7 +678,7 @@ impl fmt::Display for ThreadPoolBuildError {
678
678
/// Deprecated in favor of `ThreadPoolBuilder::build_global`.
679
679
#[ deprecated( note = "use `ThreadPoolBuilder::build_global`" ) ]
680
680
#[ allow( deprecated) ]
681
- pub fn initialize ( config : Configuration ) -> Result < ( ) , Box < Error > > {
681
+ pub fn initialize ( config : Configuration ) -> Result < ( ) , Box < dyn Error > > {
682
682
config. into_builder ( ) . build_global ( ) . map_err ( Box :: from)
683
683
}
684
684
0 commit comments