Skip to content

Commit e2c9f00

Browse files
committed
hyper: remove Clone
See #48
1 parent a0a9a04 commit e2c9f00

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/hyper.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use std::convert::TryFrom;
1111
use std::fmt::Debug;
1212
use std::io;
1313
use std::str::FromStr;
14-
use std::sync::Arc;
1514

1615
type HyperRequest = hyper::Request<hyper::Body>;
1716

@@ -28,28 +27,22 @@ impl<C: Clone + Connect + Debug + Send + Sync + 'static> HyperClientObject for h
2827

2928
/// Hyper-based HTTP Client.
3029
#[derive(Debug)]
31-
pub struct HyperClient(Arc<dyn HyperClientObject>);
30+
pub struct HyperClient(Box<dyn HyperClientObject>);
3231

3332
impl HyperClient {
3433
/// Create a new client instance.
3534
pub fn new() -> Self {
3635
let https = HttpsConnector::new();
3736
let client = hyper::Client::builder().build(https);
38-
Self(Arc::new(client))
37+
Self(Box::new(client))
3938
}
4039

4140
/// Create from externally initialized and configured client.
4241
pub fn from_client<C>(client: hyper::Client<C>) -> Self
4342
where
4443
C: Clone + Connect + Debug + Send + Sync + 'static,
4544
{
46-
Self(Arc::new(client))
47-
}
48-
}
49-
50-
impl Clone for HyperClient {
51-
fn clone(&self) -> Self {
52-
Self(self.0.clone())
45+
Self(Box::new(client))
5346
}
5447
}
5548

0 commit comments

Comments
 (0)