diff --git a/src/hyper_rustls_impl.rs b/src/hyper_rustls_impl.rs index 0a6e566..77a9c51 100644 --- a/src/hyper_rustls_impl.rs +++ b/src/hyper_rustls_impl.rs @@ -4,6 +4,12 @@ use hyper_util::client::legacy::connect::Connect; use hyper_util::client::legacy::Client as HyperClient; use hyper_util::{client::legacy::connect::HttpConnector, rt::TokioExecutor}; +impl From for Error { + fn from(value: hyper_util::client::legacy::Error) -> Self { + Self::Other(Box::new(value)) + } +} + struct DefaultClient(HyperClient, Full>); impl DefaultClient { @@ -27,7 +33,7 @@ impl HttpClient for DefaultClient { &self, req: Request>, ) -> Pin, Error>> + Send>> { - Box::pin(_response_future(self.0.request(req))) + Box::pin(handle_response_future(self.0.request(req))) } } @@ -36,7 +42,7 @@ impl HttpClient for HyperClient>, ) -> Pin, Error>> + Send>> { - Box::pin(_response_future(self.request(req))) + Box::pin(handle_response_future(self.request(req))) } } @@ -44,7 +50,7 @@ impl Account { /// Restore an existing account from the given credentials /// /// The [`AccountCredentials`] type is opaque, but supports deserialization. - pub async fn from_credentials(credentials: AccountCredentials) -> Result { + pub async fn from_credentials(credentials: AccountCredentials) -> Result { Ok(Self { inner: Arc::new( AccountInner::from_credentials(credentials, Box::new(DefaultClient::try_new()?)) @@ -57,7 +63,7 @@ impl Account { /// /// The returned [`AccountCredentials`] can be serialized and stored for later use. /// Use [`Account::from_credentials()`] to restore the account from the credentials. - pub async fn create( + pub async fn create( account: &NewAccount<'_>, server_url: &str, external_account: Option<&ExternalAccountKey>, diff --git a/src/lib.rs b/src/lib.rs index ba5f7a3..f4d35d1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -642,7 +642,7 @@ pub trait HttpClient: Send + Sync + 'static { ) -> Pin, Error>> + Send>>; } -async fn _response_future>>( +async fn handle_response_future>>( fut: impl Future, impl Into>>, ) -> Result, Error> { match fut.await { diff --git a/src/types.rs b/src/types.rs index f55ac90..47465c4 100644 --- a/src/types.rs +++ b/src/types.rs @@ -55,13 +55,6 @@ impl From<&'static str> for Error { } } -#[cfg(feature = "hyper-rustls")] -impl From for Error { - fn from(value: hyper_util::client::legacy::Error) -> Self { - Self::Other(Box::new(value)) - } -} - /// ACME account credentials /// /// This opaque type contains the account ID, the private key data and the