diff --git a/.vscode/settings.json b/.vscode/settings.json index 50ddaa6..0b5fe2e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,7 @@ { "rust-analyzer.checkOnSave.allFeatures": false, - "rust-analyzer.cargo.allFeatures": false + "rust-analyzer.cargo.allFeatures": false, + "rust-analyzer.cargo.features": [ + "runtime-tokio-native-tls" + ] } \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index d35241c..0a18c39 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sqlxmq" -version = "0.4.1" +version = "0.5.0" authors = ["Diggory Blake "] edition = "2018" license = "MIT OR Apache-2.0" @@ -23,7 +23,7 @@ uuid = { version = "1.1.2", features = ["v4"] } log = "0.4.14" serde_json = "1.0.64" serde = "1.0.124" -sqlxmq_macros = { version = "0.4.1", path = "sqlxmq_macros" } +sqlxmq_macros = { version = "0.5.0", path = "sqlxmq_macros" } anymap2 = "0.13.0" [features] diff --git a/sqlxmq_macros/Cargo.toml b/sqlxmq_macros/Cargo.toml index 92059fa..e3d03e1 100644 --- a/sqlxmq_macros/Cargo.toml +++ b/sqlxmq_macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sqlxmq_macros" -version = "0.4.1" +version = "0.5.0" authors = ["Diggory Blake "] edition = "2018" license = "MIT OR Apache-2.0" diff --git a/src/registry.rs b/src/registry.rs index 7342077..a981c48 100644 --- a/src/registry.rs +++ b/src/registry.rs @@ -15,10 +15,13 @@ use crate::hidden::{BuildFn, RunFn}; use crate::utils::Opaque; use crate::{JobBuilder, JobRunnerOptions}; +type BoxedError = Box; + /// Stores a mapping from job name to job. Can be used to construct /// a job runner. pub struct JobRegistry { - error_handler: Arc) + Send + Sync>, + #[allow(clippy::type_complexity)] + error_handler: Arc, job_map: HashMap<&'static str, &'static NamedJob>, context: Map, } @@ -53,7 +56,7 @@ impl JobRegistry { /// Set a function to be called whenever a job returns an error. pub fn set_error_handler( &mut self, - error_handler: impl Fn(&str, Box) + Send + Sync + 'static, + error_handler: impl Fn(&str, BoxedError) + Send + Sync + 'static, ) -> &mut Self { self.error_handler = Arc::new(error_handler); self @@ -83,7 +86,7 @@ impl JobRegistry { } /// The default error handler implementation, which simply logs the error. - pub fn default_error_handler(name: &str, error: Box) { + pub fn default_error_handler(name: &str, error: BoxedError) { log::error!("Job `{}` failed: {}", name, error); }