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

Return impl Future instead of Pin<Box<dyn Future>> #158

Merged
merged 1 commit into from
Apr 14, 2024
Merged
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
8 changes: 1 addition & 7 deletions src/discovery/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use thiserror::Error;

use std::fmt::Debug;
use std::future::Future;
use std::pin::Pin;

#[cfg(test)]
mod tests;
Expand Down Expand Up @@ -309,12 +308,7 @@ where
pub fn discover_async<'c, C>(
issuer_url: IssuerUrl,
http_client: &'c C,
) -> Pin<
Box<
dyn Future<Output = Result<Self, DiscoveryError<<C as AsyncHttpClient<'c>>::Error>>>
+ 'c,
>,
>
) -> impl Future<Output = Result<Self, DiscoveryError<<C as AsyncHttpClient<'c>>::Error>>> + 'c
where
Self: 'c,
C: AsyncHttpClient<'c>,
Expand Down
15 changes: 5 additions & 10 deletions src/registration/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ use thiserror::Error;
use std::fmt::{Debug, Formatter, Result as FormatterResult};
use std::future::Future;
use std::marker::PhantomData;
use std::pin::Pin;
use std::time::Duration;

#[cfg(test)]
Expand Down Expand Up @@ -450,16 +449,12 @@ where
&'c self,
registration_endpoint: &'c RegistrationUrl,
http_client: &'c C,
) -> Pin<
Box<
dyn Future<
Output = Result<
ClientRegistrationResponse<AC, AR, AT, CA, G, JE, JK, K, RT, S>,
ClientRegistrationError<ET, <C as AsyncHttpClient<'c>>::Error>,
>,
> + 'c,
) -> impl Future<
Output = Result<
ClientRegistrationResponse<AC, AR, AT, CA, G, JE, JK, K, RT, S>,
ClientRegistrationError<ET, <C as AsyncHttpClient<'c>>::Error>,
>,
>
> + 'c
where
Self: 'c,
C: AsyncHttpClient<'c>,
Expand Down
8 changes: 1 addition & 7 deletions src/types/jwks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use serde::{Deserialize, Serialize};
use serde_with::{serde_as, VecSkipError};

use std::future::Future;
use std::pin::Pin;

new_url_type![
/// JSON Web Key Set URL.
Expand Down Expand Up @@ -114,12 +113,7 @@ where
pub fn fetch_async<'c, C>(
url: &JsonWebKeySetUrl,
http_client: &'c C,
) -> Pin<
Box<
dyn Future<Output = Result<Self, DiscoveryError<<C as AsyncHttpClient<'c>>::Error>>>
+ 'c,
>,
>
) -> impl Future<Output = Result<Self, DiscoveryError<<C as AsyncHttpClient<'c>>::Error>>> + 'c
where
Self: 'c,
C: AsyncHttpClient<'c>,
Expand Down
14 changes: 3 additions & 11 deletions src/user_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use serde::{Deserialize, Serialize};
use thiserror::Error;

use std::future::Future;
use std::pin::Pin;
use std::str;

impl<
Expand Down Expand Up @@ -152,16 +151,9 @@ where
pub fn request_async<'c, AC, C, GC>(
self,
http_client: &'c C,
) -> Pin<
Box<
dyn Future<
Output = Result<
UserInfoClaims<AC, GC>,
UserInfoError<<C as AsyncHttpClient<'c>>::Error>,
>,
> + 'c,
>,
>
) -> impl Future<
Output = Result<UserInfoClaims<AC, GC>, UserInfoError<<C as AsyncHttpClient<'c>>::Error>>,
> + 'c
where
Self: 'c,
AC: AdditionalClaims,
Expand Down
Loading