Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump deps #54

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 31 additions & 17 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@ documentation = "https://docs.rs/delay_timer"
readme = "README.md"
homepage = "https://github.com/BinChengZhao/delay-timer"
description = "Time-manager of delayed tasks. Like crontab, but synchronous asynchronous tasks are possible, and dynamic add/cancel/remove is supported."
keywords = [ "cron", "scheduler", "timer", "crontab", "delay" ]
keywords = ["cron", "scheduler", "timer", "crontab", "delay"]
license = "Apache-2.0 OR MIT"
categories = ["development-tools", "data-structures", "asynchronous", "data-structures", "accessibility"]
categories = [
"development-tools",
"data-structures",
"asynchronous",
"data-structures",
"accessibility",
]
build = "build/build.rs"


Expand All @@ -30,14 +36,14 @@ status-report = []
cron_clock = "0.8.0"
anyhow = "^1.0.31"
rs-snowflake = "0.6.0"
dashmap = "=5.5.3"
dashmap = "6"
lru = "0.12.3"
once_cell = "1.9.0"
futures = "^0.3.13"
smol = "^1.2.5"
smol = "2"
concat-idents = "1.1.3"
async-trait = "^0.1.48"
event-listener = "=5.3.0"
event-listener = "5"
log = "0.4.14"
tracing = "0.1.29"
thiserror = "^1.0.24"
Expand All @@ -46,27 +52,29 @@ thiserror = "^1.0.24"
tokio = { version = "^1.3.0", features = ["full"] }

[dev-dependencies]
rand = "0.8.4"
rand = "0.8.5"
surf = "^2.1.0"
tracing-error = { version = "0.1.2" }
tracing-subscriber = "0.2.0"
tracing-error = { version = "0.2" }
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
tokio = { version = "^1.3.0", features = ["full"] }
hyper= {version = "^0.14.2" , features = ["full"] }
pretty_env_logger = "^0.4"
mockall = "^0.8.2"
env_logger = "^0.8.3"
color-eyre = { version = "0.5.11", features = ["capture-spantrace", "issue-url"]}
pretty_assertions = "0.6.1"
hyper = { version = "1.4", features = ["full"] }
hyper-util = { version = "0.1", features = ["full"] }
http-body-util = "0.1.2"
pretty_env_logger = "0.5"
mockall = "^0.13"
env_logger = "^0.11.5"
color-eyre = { version = "0.6", features = ["capture-spantrace", "issue-url"] }
pretty_assertions = "1.4.1"
thiserror = "1.0.19"
ansi-parser = "0.6.5" # used for testing color schemes
ansi-parser = "0.9.1" # used for testing color schemes

[dev-dependencies.async-std]
version = "^1.9.0"
features = ["attributes", "unstable"]

[build-dependencies]
autocfg = "1"
rustc_version = "^0.2"
rustc_version = "0.4"

# Append the cfg-tag:docsrs to activate the feature(doc_cfg) attribute
# when generating a document on docs.rs.
Expand All @@ -89,6 +97,12 @@ name = "demo"
path = "examples/demo.rs"
required-features = ["full"]

[[example]]
name = "generic"
path = "examples/generic.rs"
required-features = ["full"]


#[[test]]
#name = "inspect_struct"
#path = "tests/simulation.rs"
Expand All @@ -100,4 +114,4 @@ required-features = ["full"]
#required-features = ["full"]

[profile.dev.package.backtrace]
opt-level = 3
opt-level = 3
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,10 @@ fn build_task_async_print() -> Result<Task, TaskError> {
``` rust
#[macro_use]
use delay_timer::prelude::*;
use hyper::{Client, Uri};
use http_body_util::{BodyExt, Empty};
use hyper::{body::Bytes, Uri};
use hyper_util::{client::legacy::Client, rt::TokioExecutor};


fn build_task_customized_async_task() -> Result<Task, TaskError> {
let id = 1;
Expand Down
8 changes: 5 additions & 3 deletions examples/cycle_tokio_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

use anyhow::Result;
use delay_timer::prelude::*;
use hyper::{Client, Uri};
use http_body_util::{BodyExt, Empty};
use hyper::{body::Bytes, Uri};
use hyper_util::{client::legacy::Client, rt::TokioExecutor};
use std::thread::{current, park, Thread};

// When you try to run that's example nedd add feature `tokio-support`.
Expand Down Expand Up @@ -62,7 +64,7 @@ pub async fn generate_closure_template() {
}

pub async fn async_template(id: i32, name: String) -> Result<()> {
let client = Client::new();
let client = Client::builder(TokioExecutor::new()).build_http::<Empty<Bytes>>();

// The default connector does not handle TLS.
// Speaking to https destinations will require configuring a connector that implements TLS.
Expand All @@ -73,7 +75,7 @@ pub async fn async_template(id: i32, name: String) -> Result<()> {
let res = client.get(uri).await?;
println!("Response: {}", res.status());
// Concatenate the body stream into a single buffer...
let buf = hyper::body::to_bytes(res).await?;
let buf = res.into_body().collect().await?.to_bytes();
println!("body: {buf:?}");
Ok(())
}
Expand Down
11 changes: 8 additions & 3 deletions examples/demo_async_tokio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ use anyhow::Result;
use delay_timer::prelude::*;
#[allow(deprecated)]
use delay_timer::utils::convenience::functions::unblock_process_task_fn;
use hyper::{Client, Uri};
use http_body_util::{combinators::BoxBody, BodyExt, Empty};
use hyper::{
body::{Body, Bytes},
Uri,
};
use hyper_util::{client::legacy::Client, rt::TokioExecutor};
use std::time::Duration;
use tokio::time::sleep;
use tracing::Level;
Expand Down Expand Up @@ -95,7 +100,7 @@ fn build_task_async_execute_process() -> Result<Task, TaskError> {
}

pub async fn async_template(id: i32, name: String) -> Result<()> {
let client = Client::new();
let client = Client::builder(TokioExecutor::new()).build_http::<Empty<Bytes>>();

// The default connector does not handle TLS.
// Speaking to https destinations will require configuring a connector that implements TLS.
Expand All @@ -106,7 +111,7 @@ pub async fn async_template(id: i32, name: String) -> Result<()> {
let res = client.get(uri).await?;
println!("Response: {}", res.status());
// Concatenate the body stream into a single buffer...
let buf = hyper::body::to_bytes(res).await?;
let buf = res.into_body().collect().await?.to_bytes();
println!("body: {buf:?}");
Ok(())
}
8 changes: 5 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@
//! use std::time::Duration;
//! use smol::Timer;
//! use tokio::time::sleep;
//! use hyper::{Client, Uri};
//! use http_body_util::{BodyExt, Empty};
//! use hyper::{body::Bytes, Uri};
//! use hyper_util::{client::legacy::Client, rt::TokioExecutor};
//!
//!
//!
Expand All @@ -217,7 +219,7 @@
//!
//!
//! pub async fn async_template(id: i32, name: String) -> Result<()> {
//! let client = Client::new();
//! let client = Client::builder(TokioExecutor::new()).build_http::<Empty<Bytes>>();
//!
//! // The default connector does not handle TLS.
//! // Speaking to https destinations will require configuring a connector that implements TLS.
Expand All @@ -228,7 +230,7 @@
//! let res = client.get(uri).await?;
//! println!("Response: {}", res.status());
//! // Concatenate the body stream into a single buffer...
//! let buf = hyper::body::to_bytes(res).await?;
//! let buf = res.into_body().collect().await?.to_bytes();
//! println!("body: {:?}", buf);
//! Ok(())
//! }
Expand Down
5 changes: 2 additions & 3 deletions src/timer/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ pub(crate) enum FrequencyInner {
SecondsCountDown(u64, SecondsState),
}

impl<'a> TryFrom<(FrequencyUnify<'a>, ScheduleIteratorTimeZone)> for FrequencyInner {
impl TryFrom<(FrequencyUnify<'_>, ScheduleIteratorTimeZone)> for FrequencyInner {
type Error = FrequencyAnalyzeError;

fn try_from(
Expand Down Expand Up @@ -385,9 +385,8 @@ impl DelayTimerScheduleIteratorOwned {
let new_result =
DelayTimerScheduleIteratorOwned::new(schedule_iterator_time_zone_query.clone());

new_result.map(|task_schedule| {
new_result.inspect(|task_schedule| {
lru_cache.put(schedule_iterator_time_zone_query, task_schedule.clone());
task_schedule
})
})?;

Expand Down
2 changes: 1 addition & 1 deletion src/utils/convenience.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pub mod functions {
#[inline(always)]
///convert task_handler of impl DelayTaskHandler to a `Box<dyn DelayTaskHander>`.
pub fn create_delay_task_handler(
task_handle: impl DelayTaskHandler + 'static + Send + Sync,
task_handle: impl DelayTaskHandler + 'static,
) -> Box<dyn DelayTaskHandler> {
Box::new(task_handle) as Box<dyn DelayTaskHandler>
}
Expand Down