Skip to content

Commit

Permalink
Bump version and fix clippy warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Diggsey committed Oct 11, 2023
1 parent 5e4f160 commit 039b04b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sqlxmq"
version = "0.4.1"
version = "0.5.0"
authors = ["Diggory Blake <diggsey@googlemail.com>"]
edition = "2018"
license = "MIT OR Apache-2.0"
Expand All @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion sqlxmq_macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sqlxmq_macros"
version = "0.4.1"
version = "0.5.0"
authors = ["Diggory Blake <diggsey@googlemail.com>"]
edition = "2018"
license = "MIT OR Apache-2.0"
Expand Down
11 changes: 7 additions & 4 deletions src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ use crate::hidden::{BuildFn, RunFn};
use crate::utils::Opaque;
use crate::{JobBuilder, JobRunnerOptions};

type BoxedError = Box<dyn Error + Send + 'static>;

/// Stores a mapping from job name to job. Can be used to construct
/// a job runner.
pub struct JobRegistry {
error_handler: Arc<dyn Fn(&str, Box<dyn Error + Send + 'static>) + Send + Sync>,
#[allow(clippy::type_complexity)]
error_handler: Arc<dyn Fn(&str, BoxedError) + Send + Sync>,
job_map: HashMap<&'static str, &'static NamedJob>,
context: Map<dyn CloneAnySendSync + Send + Sync>,
}
Expand Down Expand Up @@ -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<dyn Error + Send + 'static>) + Send + Sync + 'static,
error_handler: impl Fn(&str, BoxedError) + Send + Sync + 'static,
) -> &mut Self {
self.error_handler = Arc::new(error_handler);
self
Expand Down Expand Up @@ -83,12 +86,12 @@ impl JobRegistry {
}

/// The default error handler implementation, which simply logs the error.
pub fn default_error_handler(name: &str, error: Box<dyn Error + Send + 'static>) {
pub fn default_error_handler(name: &str, error: BoxedError) {
log::error!("Job `{}` failed: {}", name, error);
}

#[doc(hidden)]
pub fn spawn_internal<E: Into<Box<dyn Error + Send + Sync + 'static>>>(
pub fn spawn_internal<E: Into<BoxedError>>(
&self,
name: &'static str,
f: impl Future<Output = Result<(), E>> + Send + 'static,
Expand Down

0 comments on commit 039b04b

Please sign in to comment.