From 7d5fb13df03eeef85b43da4f66a7705895ea135d Mon Sep 17 00:00:00 2001 From: AH-dark Date: Sat, 6 Jul 2024 14:03:37 +0800 Subject: [PATCH] fix: type definition error --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/cron.rs | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 09df449..61b7f44 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -246,7 +246,7 @@ dependencies = [ [[package]] name = "distributed-scheduler" -version = "2.0.0" +version = "2.0.1" dependencies = [ "async-trait", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 754eda2..e502f04 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "distributed-scheduler" description = "A distributed cronjob library" -version = "2.0.0" +version = "2.0.1" edition = "2021" repository = "https://github.com/AH-dark/distributed-scheduler.git" homepage = "https://github.com/AH-dark/distributed-scheduler" diff --git a/src/cron.rs b/src/cron.rs index 595f480..3d3e456 100644 --- a/src/cron.rs +++ b/src/cron.rs @@ -1,4 +1,5 @@ use std::collections::HashMap; +use std::future::Future; use std::sync::Arc; use job_scheduler::{Schedule, Uuid}; @@ -102,9 +103,10 @@ impl<'a> Cron<'a> { /// * `schedule` - The schedule of the job /// * `run` - The async function to run /// - pub async fn add_async_job(&self, job_name: &str, schedule: Schedule, run: F) -> Result<(), Error> + pub async fn add_async_job(&self, job_name: &str, schedule: Schedule, run: F) -> Result<(), Error> where - F: 'static + Sync + Send + Fn() -> tokio::task::JoinHandle<()>, + F: 'static + Sync + Send + Fn() -> Fut, + Fut: Future>> + Send, { let run = Arc::new(run);