File tree Expand file tree Collapse file tree 3 files changed +2
-5
lines changed Expand file tree Collapse file tree 3 files changed +2
-5
lines changed Original file line number Diff line number Diff line change 1
1
use std:: error:: Error ;
2
+ use std:: future:: Future ;
2
3
use std:: sync:: Arc ;
3
4
use std:: time:: Instant ;
4
5
@@ -10,10 +11,9 @@ const CACHE_TTL_SECS: u64 = 120;
10
11
11
12
pub type Cache < T > = State < Arc < RwLock < T > > > ;
12
13
13
- #[ async_trait]
14
14
pub trait Cached : Send + Sync + Clone + ' static {
15
15
fn get_timestamp ( & self ) -> Instant ;
16
- async fn fetch ( ) -> Result < Self , Box < dyn Error + Send + Sync > > ;
16
+ fn fetch ( ) -> impl Future < Output = Result < Self , Box < dyn Error + Send + Sync > > > + Send ;
17
17
async fn get ( cache : & Cache < Self > ) -> Self {
18
18
let cached = cache. read ( ) . await . clone ( ) ;
19
19
let timestamp = cached. get_timestamp ( ) ;
Original file line number Diff line number Diff line change @@ -42,7 +42,6 @@ impl Default for RustVersion {
42
42
}
43
43
}
44
44
45
- #[ async_trait]
46
45
impl Cached for RustVersion {
47
46
fn get_timestamp ( & self ) -> Instant {
48
47
self . 1
@@ -68,7 +67,6 @@ impl Default for RustReleasePost {
68
67
}
69
68
}
70
69
71
- #[ async_trait]
72
70
impl Cached for RustReleasePost {
73
71
fn get_timestamp ( & self ) -> Instant {
74
72
self . 1
Original file line number Diff line number Diff line change @@ -238,7 +238,6 @@ impl Default for RustTeams {
238
238
}
239
239
}
240
240
241
- #[ async_trait]
242
241
impl Cached for RustTeams {
243
242
fn get_timestamp ( & self ) -> Instant {
244
243
self . 1
You can’t perform that action at this time.
0 commit comments