Skip to content

Commit

Permalink
Merge pull request #214 from bernharddick/switch-to-web-time
Browse files Browse the repository at this point in the history
Replace instant with web-time
  • Loading branch information
jaemk committed Jul 20, 2024
2 parents 61117ca + 79efee6 commit 6a9d7e5
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ redis_async_std = ["redis_store", "async", "redis/aio", "redis/async-std-comp",
redis_tokio = ["redis_store", "async", "redis/aio", "redis/tokio-comp", "redis/tls", "redis/tokio-native-tls-comp"]
redis_ahash = ["redis_store", "redis/ahash"]
disk_store = ["sled", "serde", "rmp-serde", "directories"]
wasm = ["instant/wasm-bindgen"]
wasm = []

[dependencies.cached_proc_macro]
version = "0.22.0"
Expand Down Expand Up @@ -99,8 +99,8 @@ version = "1"
features = ["macros", "time", "sync", "parking_lot"]
optional = true

[dependencies.instant]
version = "0.1"
[dependencies.web-time]
version = "^1.1.0"

[dev-dependencies]
copy_dir = "0.1.3"
Expand Down
6 changes: 3 additions & 3 deletions cached_proc_macro/src/once.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ pub fn once(args: TokenStream, input: TokenStream) -> TokenStream {
let (cache_ty, cache_create) = match &args.time {
None => (quote! { Option<#cache_value_ty> }, quote! { None }),
Some(_) => (
quote! { Option<(::cached::instant::Instant, #cache_value_ty)> },
quote! { Option<(::cached::web_time::Instant, #cache_value_ty)> },
quote! { None },
),
};
Expand Down Expand Up @@ -262,14 +262,14 @@ pub fn once(args: TokenStream, input: TokenStream) -> TokenStream {
// Cached function
#(#attributes)*
#visibility #signature_no_muts {
let now = ::cached::instant::Instant::now();
let now = ::cached::web_time::Instant::now();
#do_set_return_block
}
// Prime cached function
#[doc = #prime_fn_indent_doc]
#[allow(dead_code)]
#visibility #prime_sig {
let now = ::cached::instant::Instant::now();
let now = ::cached::web_time::Instant::now();
#prime_do_set_return_block
}
};
Expand Down
2 changes: 1 addition & 1 deletion examples/expiring_sized_cache.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use cached::stores::ExpiringSizedCache;
use instant::Instant;
use std::sync::Arc;
use std::time::Duration;
use tokio::sync::RwLock;
use web_time::Instant;

#[tokio::main]
async fn main() {
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ pub mod macros;
pub mod proc_macro;
pub mod stores;
#[doc(hidden)]
pub use instant;
pub use web_time;

#[cfg(feature = "async")]
#[doc(hidden)]
Expand Down
2 changes: 1 addition & 1 deletion src/stores/disk.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use crate::IOCached;
use directories::BaseDirs;
use instant::Duration;
use serde::de::DeserializeOwned;
use serde::Serialize;
use sled::Db;
use std::marker::PhantomData;
use std::path::Path;
use std::{path::PathBuf, time::SystemTime};
use web_time::Duration;

pub struct DiskCacheBuilder<K, V> {
seconds: Option<u64>,
Expand Down
2 changes: 1 addition & 1 deletion src/stores/timed.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use instant::Instant;
use std::cmp::Eq;
use std::hash::Hash;
use web_time::Instant;

#[cfg(feature = "ahash")]
use hashbrown::{hash_map::Entry, HashMap};
Expand Down
2 changes: 1 addition & 1 deletion src/stores/timed_sized.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::cmp::Eq;
use std::hash::Hash;

use instant::Instant;
use web_time::Instant;

#[cfg(feature = "async")]
use {super::CachedAsync, async_trait::async_trait, futures::Future};
Expand Down

0 comments on commit 6a9d7e5

Please sign in to comment.