Replace manual Clone impl with educe in arti-hyper
This commit is contained in:
parent
ea03cc4084
commit
decdd05ec5
|
@ -172,6 +172,7 @@ version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"arti-client",
|
"arti-client",
|
||||||
|
"educe",
|
||||||
"hyper",
|
"hyper",
|
||||||
"pin-project",
|
"pin-project",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
|
|
|
@ -25,6 +25,7 @@ experimental-api = []
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "1.0.23"
|
anyhow = "1.0.23"
|
||||||
arti-client = { path="../arti-client", version = "0.1.0"}
|
arti-client = { path="../arti-client", version = "0.1.0"}
|
||||||
|
educe = "0.4.6"
|
||||||
hyper = { version = "0.14", features = ["http1", "client", "runtime"] }
|
hyper = { version = "0.14", features = ["http1", "client", "runtime"] }
|
||||||
pin-project = "1"
|
pin-project = "1"
|
||||||
tokio = { package = "tokio", version = "1.7", features = ["rt", "rt-multi-thread", "io-util", "net", "time", "macros" ] }
|
tokio = { package = "tokio", version = "1.7", features = ["rt", "rt-multi-thread", "io-util", "net", "time", "macros" ] }
|
||||||
|
|
|
@ -45,6 +45,7 @@ use std::sync::Arc;
|
||||||
use std::task::{Context, Poll};
|
use std::task::{Context, Poll};
|
||||||
|
|
||||||
use arti_client::{DataStream, IntoTorAddr, TorClient};
|
use arti_client::{DataStream, IntoTorAddr, TorClient};
|
||||||
|
use educe::Educe;
|
||||||
use hyper::client::connect::{Connected, Connection};
|
use hyper::client::connect::{Connected, Connection};
|
||||||
use hyper::http::uri::Scheme;
|
use hyper::http::uri::Scheme;
|
||||||
use hyper::http::Uri;
|
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.
|
/// 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
|
/// It might even be a different underlying TLS implementation
|
||||||
/// (although that is usually not a particularly good idea).
|
/// (although that is usually not a particularly good idea).
|
||||||
|
#[derive(Educe)]
|
||||||
|
#[educe(Clone)] // #[derive(Debug)] infers an unwanted bound TC: Clone
|
||||||
pub struct ArtiHttpConnector<R: Runtime, TC: TlsConn> {
|
pub struct ArtiHttpConnector<R: Runtime, TC: TlsConn> {
|
||||||
/// The client
|
/// The client
|
||||||
client: TorClient<R>,
|
client: TorClient<R>,
|
||||||
|
@ -120,13 +123,6 @@ pub struct ArtiHttpConnector<R: Runtime, TC: TlsConn> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// #[derive(Clone)] infers a TC: Clone bound
|
// #[derive(Clone)] infers a TC: Clone bound
|
||||||
impl<R: Runtime, TC: TlsConn> Clone for ArtiHttpConnector<R, TC> {
|
|
||||||
fn clone(&self) -> Self {
|
|
||||||
let client = self.client.clone();
|
|
||||||
let tls_conn = self.tls_conn.clone();
|
|
||||||
Self { client, tls_conn }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<R: Runtime, TC: TlsConn> ArtiHttpConnector<R, TC> {
|
impl<R: Runtime, TC: TlsConn> ArtiHttpConnector<R, TC> {
|
||||||
/// Make a new `ArtiHttpConnector` using an Arti `TorClient` object.
|
/// Make a new `ArtiHttpConnector` using an Arti `TorClient` object.
|
||||||
|
|
Loading…
Reference in New Issue