Skip to content

Commit

Permalink
feat: Add Send bound to interceptors (#532)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
aDogCalledSpot authored Mar 11, 2024
1 parent f1133ad commit d797a21
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/api/clients.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ enum AuthType {
/// stays the same and is not dependent on the authentication type used.
/// The builder can always return `Client<InterceptedService<Channel, ChainedInterceptor>>`.
pub struct ChainedInterceptor {
interceptors: Vec<Box<dyn Interceptor>>,
interceptors: Vec<Box<dyn Interceptor + Send>>,
}

impl ChainedInterceptor {
Expand All @@ -56,7 +56,7 @@ impl ChainedInterceptor {
}
}

pub(crate) fn add_interceptor(mut self, interceptor: Box<dyn Interceptor>) -> Self {
pub(crate) fn add_interceptor(mut self, interceptor: Box<dyn Interceptor + Send>) -> Self {
self.interceptors.push(interceptor);
self
}
Expand Down
4 changes: 2 additions & 2 deletions src/oidc/introspection/cache/in_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ mod tests {
#![allow(clippy::all)]

use crate::oidc::introspection::cache::IntrospectionCache;
use chrono::{Duration, Utc};
use chrono::{TimeDelta, Utc};

use super::*;

Expand Down Expand Up @@ -120,7 +120,7 @@ mod tests {
let t = &c as &dyn IntrospectionCache;

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

t.set("token1", response.clone()).await;
t.set("token2", response.clone()).await;
Expand Down

0 comments on commit d797a21

Please sign in to comment.