diff --git a/Cargo.lock b/Cargo.lock index f2b6decb2..623f38277 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -172,6 +172,7 @@ version = "0.1.0" dependencies = [ "anyhow", "arti-client", + "educe", "hyper", "pin-project", "thiserror", diff --git a/crates/arti-hyper/Cargo.toml b/crates/arti-hyper/Cargo.toml index 1be824035..d659c5ef6 100644 --- a/crates/arti-hyper/Cargo.toml +++ b/crates/arti-hyper/Cargo.toml @@ -25,6 +25,7 @@ experimental-api = [] [dependencies] anyhow = "1.0.23" arti-client = { path="../arti-client", version = "0.1.0"} +educe = "0.4.6" hyper = { version = "0.14", features = ["http1", "client", "runtime"] } pin-project = "1" tokio = { package = "tokio", version = "1.7", features = ["rt", "rt-multi-thread", "io-util", "net", "time", "macros" ] } diff --git a/crates/arti-hyper/src/lib.rs b/crates/arti-hyper/src/lib.rs index b1fab846c..cb91b336b 100644 --- a/crates/arti-hyper/src/lib.rs +++ b/crates/arti-hyper/src/lib.rs @@ -45,6 +45,7 @@ use std::sync::Arc; use std::task::{Context, Poll}; use arti_client::{DataStream, IntoTorAddr, TorClient}; +use educe::Educe; use hyper::client::connect::{Connected, Connection}; use hyper::http::uri::Scheme; use hyper::http::Uri; @@ -111,6 +112,8 @@ impl tor_error::HasKind for ConnectionError { /// This is a different Rust type to the TLS used *by* Tor to connect to relays etc. /// It might even be a different underlying TLS implementation /// (although that is usually not a particularly good idea). +#[derive(Educe)] +#[educe(Clone)] // #[derive(Debug)] infers an unwanted bound TC: Clone pub struct ArtiHttpConnector { /// The client client: TorClient, @@ -120,13 +123,6 @@ pub struct ArtiHttpConnector { } // #[derive(Clone)] infers a TC: Clone bound -impl Clone for ArtiHttpConnector { - fn clone(&self) -> Self { - let client = self.client.clone(); - let tls_conn = self.tls_conn.clone(); - Self { client, tls_conn } - } -} impl ArtiHttpConnector { /// Make a new `ArtiHttpConnector` using an Arti `TorClient` object.