Skip to content

Commit d797a21

Browse files
author
Ari
authored
feat: Add Send bound to interceptors (#532)
Autoderived Send implementations are lost when using trait objects. Missing Send bounds can be an issue in async contexts and there doesn't appear to be a reason not to introduce it within this repo.
1 parent f1133ad commit d797a21

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/api/clients.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ enum AuthType {
4646
/// stays the same and is not dependent on the authentication type used.
4747
/// The builder can always return `Client<InterceptedService<Channel, ChainedInterceptor>>`.
4848
pub struct ChainedInterceptor {
49-
interceptors: Vec<Box<dyn Interceptor>>,
49+
interceptors: Vec<Box<dyn Interceptor + Send>>,
5050
}
5151

5252
impl ChainedInterceptor {
@@ -56,7 +56,7 @@ impl ChainedInterceptor {
5656
}
5757
}
5858

59-
pub(crate) fn add_interceptor(mut self, interceptor: Box<dyn Interceptor>) -> Self {
59+
pub(crate) fn add_interceptor(mut self, interceptor: Box<dyn Interceptor + Send>) -> Self {
6060
self.interceptors.push(interceptor);
6161
self
6262
}

src/oidc/introspection/cache/in_memory.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ mod tests {
6161
#![allow(clippy::all)]
6262

6363
use crate::oidc::introspection::cache::IntrospectionCache;
64-
use chrono::{Duration, Utc};
64+
use chrono::{TimeDelta, Utc};
6565

6666
use super::*;
6767

@@ -120,7 +120,7 @@ mod tests {
120120
let t = &c as &dyn IntrospectionCache;
121121

122122
let mut response = Response::new(true, Default::default());
123-
response.set_exp(Some(Utc::now() - Duration::seconds(10)));
123+
response.set_exp(Some(Utc::now() - TimeDelta::try_seconds(10).unwrap()));
124124

125125
t.set("token1", response.clone()).await;
126126
t.set("token2", response.clone()).await;

0 commit comments

Comments
 (0)