diff --git a/src/h1.rs b/src/h1.rs index 44b8476..43a6b14 100644 --- a/src/h1.rs +++ b/src/h1.rs @@ -7,7 +7,9 @@ use http_types::StatusCode; /// Async-h1 based HTTP Client. #[derive(Debug)] -pub struct H1Client {} +pub struct H1Client { + _priv: (), +} impl Default for H1Client { fn default() -> Self { @@ -18,13 +20,7 @@ impl Default for H1Client { impl H1Client { /// Create a new instance. pub fn new() -> Self { - Self {} - } -} - -impl Clone for H1Client { - fn clone(&self) -> Self { - Self {} + Self { _priv: () } } } diff --git a/src/isahc.rs b/src/isahc.rs index 9a00370..fff1f71 100644 --- a/src/isahc.rs +++ b/src/isahc.rs @@ -4,13 +4,10 @@ use super::{async_trait, Body, Error, HttpClient, Request, Response}; use async_std::io::BufReader; use isahc::http; -use std::sync::Arc; /// Curl-based HTTP Client. #[derive(Debug)] -pub struct IsahcClient { - client: Arc, -} +pub struct IsahcClient(isahc::HttpClient); impl Default for IsahcClient { fn default() -> Self { @@ -26,17 +23,7 @@ impl IsahcClient { /// Create from externally initialized and configured client. pub fn from_client(client: isahc::HttpClient) -> Self { - Self { - client: Arc::new(client), - } - } -} - -impl Clone for IsahcClient { - fn clone(&self) -> Self { - Self { - client: self.client.clone(), - } + Self(client) } } @@ -59,7 +46,7 @@ impl HttpClient for IsahcClient { }; let request = builder.body(body).unwrap(); - let res = self.client.send_async(request).await.map_err(Error::from)?; + let res = self.0.send_async(request).await.map_err(Error::from)?; let (parts, body) = res.into_parts(); let len = body.len().map(|len| len as usize); let body = Body::from_reader(BufReader::new(body), len); diff --git a/src/wasm.rs b/src/wasm.rs index 0233861..805dc1e 100644 --- a/src/wasm.rs +++ b/src/wasm.rs @@ -21,12 +21,6 @@ impl WasmClient { } } -impl Clone for WasmClient { - fn clone(&self) -> Self { - Self { _priv: () } - } -} - impl HttpClient for WasmClient { fn send<'a, 'async_trait>( &'a self,