@@ -140,7 +140,7 @@ pub struct ThreadPoolBuilder<S = DefaultSpawn> {
140140 panic_handler : Option < Box < PanicHandler > > ,
141141
142142 /// 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 > > ,
144144
145145 /// The stack size for the created worker threads
146146 stack_size : Option < usize > ,
@@ -170,17 +170,17 @@ pub struct Configuration {
170170
171171/// The type for a panic handling closure. Note that this same closure
172172/// 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 ;
174174
175175/// The type for a closure that gets invoked when a thread starts. The
176176/// closure is passed the index of the thread on which it is invoked.
177177/// 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 ;
179179
180180/// The type for a closure that gets invoked when a thread exits. The
181181/// closure is passed the index of the thread on which is is invoked.
182182/// 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 ;
184184
185185// NB: We can't `#[derive(Default)]` because `S` is left ambiguous.
186186impl Default for ThreadPoolBuilder {
@@ -481,7 +481,7 @@ impl<S> ThreadPoolBuilder<S> {
481481 /// in a call to `std::panic::catch_unwind()`.
482482 pub fn panic_handler < H > ( mut self , panic_handler : H ) -> Self
483483 where
484- H : Fn ( Box < Any + Send > ) + Send + Sync + ' static ,
484+ H : Fn ( Box < dyn Any + Send > ) + Send + Sync + ' static ,
485485 {
486486 self . panic_handler = Some ( Box :: new ( panic_handler) ) ;
487487 self
@@ -585,7 +585,7 @@ impl Configuration {
585585 }
586586
587587 /// 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 > > {
589589 self . builder . build ( ) . map_err ( Box :: from)
590590 }
591591
@@ -607,7 +607,7 @@ impl Configuration {
607607 /// Deprecated in favor of `ThreadPoolBuilder::panic_handler`.
608608 pub fn panic_handler < H > ( mut self , panic_handler : H ) -> Configuration
609609 where
610- H : Fn ( Box < Any + Send > ) + Send + Sync + ' static ,
610+ H : Fn ( Box < dyn Any + Send > ) + Send + Sync + ' static ,
611611 {
612612 self . builder = self . builder . panic_handler ( panic_handler) ;
613613 self
@@ -678,7 +678,7 @@ impl fmt::Display for ThreadPoolBuildError {
678678/// Deprecated in favor of `ThreadPoolBuilder::build_global`.
679679#[ deprecated( note = "use `ThreadPoolBuilder::build_global`" ) ]
680680#[ allow( deprecated) ]
681- pub fn initialize ( config : Configuration ) -> Result < ( ) , Box < Error > > {
681+ pub fn initialize ( config : Configuration ) -> Result < ( ) , Box < dyn Error > > {
682682 config. into_builder ( ) . build_global ( ) . map_err ( Box :: from)
683683}
684684
0 commit comments