S + Send + Sync>;
/// A type for storing the relationships between processor names and the processor itself
///
/// [`Processor`s](https://docs.rs/background-jobs/0.4.0/background_jobs/trait.Processor.html) must
/// be registered with the `ProcessorMap` in the initialization phase of an application before
/// workers are spawned in order to handle queued jobs.
+#[derive(Clone)]
pub struct ProcessorMap
where
S: Clone,
@@ -74,12 +75,12 @@ where
/// make sure to register all your processors up-front.
pub fn register_processor(&mut self, processor: P)
where
- P: Processor + Send + 'static,
+ P: Processor + Sync + Send + 'static,
J: Job,
{
self.inner.insert(
P::NAME.to_owned(),
- Box::new(move |value, state| processor.process(value, state)),
+ Arc::new(move |value, state| processor.process(value, state)),
);
}