Replace manual Clone impl with educe in tor-rtcompat
This commit is contained in:
parent
9dca756e23
commit
ea03cc4084
|
@ -3492,6 +3492,7 @@ dependencies = [
|
||||||
"async-std",
|
"async-std",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"async_executors",
|
"async_executors",
|
||||||
|
"educe",
|
||||||
"futures",
|
"futures",
|
||||||
"native-tls",
|
"native-tls",
|
||||||
"pin-project",
|
"pin-project",
|
||||||
|
|
|
@ -25,6 +25,7 @@ rustls = [ "rustls-crate", "async-rustls", "x509-signature" ]
|
||||||
|
|
||||||
async_executors = { version = "0.4", default_features = false }
|
async_executors = { version = "0.4", default_features = false }
|
||||||
async-trait = "0.1.2"
|
async-trait = "0.1.2"
|
||||||
|
educe = "0.4.6"
|
||||||
futures = "0.3.14"
|
futures = "0.3.14"
|
||||||
pin-project = "1"
|
pin-project = "1"
|
||||||
native-tls-crate = { package = "native-tls", version = "0.2", optional = true }
|
native-tls-crate = { package = "native-tls", version = "0.2", optional = true }
|
||||||
|
|
|
@ -5,6 +5,7 @@ use std::{net::SocketAddr, sync::Arc, time::Duration};
|
||||||
|
|
||||||
use crate::traits::*;
|
use crate::traits::*;
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
|
use educe::Educe;
|
||||||
use futures::{future::FutureObj, task::Spawn};
|
use futures::{future::FutureObj, task::Spawn};
|
||||||
use std::io::Result as IoResult;
|
use std::io::Result as IoResult;
|
||||||
|
|
||||||
|
@ -18,6 +19,8 @@ use std::io::Result as IoResult;
|
||||||
/// You can use this structure to create new runtimes in two ways: either by
|
/// You can use this structure to create new runtimes in two ways: either by
|
||||||
/// overriding a single part of an existing runtime, or by building an entirely
|
/// overriding a single part of an existing runtime, or by building an entirely
|
||||||
/// new runtime from pieces.
|
/// new runtime from pieces.
|
||||||
|
#[derive(Educe)]
|
||||||
|
#[educe(Clone)] // #[derive(Clone)] wrongly infers Clone bounds on the generic parameters
|
||||||
pub struct CompoundRuntime<SpawnR, SleepR, TcpR, TlsR> {
|
pub struct CompoundRuntime<SpawnR, SleepR, TcpR, TlsR> {
|
||||||
/// The actual collection of Runtime objects.
|
/// The actual collection of Runtime objects.
|
||||||
///
|
///
|
||||||
|
@ -26,16 +29,6 @@ pub struct CompoundRuntime<SpawnR, SleepR, TcpR, TlsR> {
|
||||||
inner: Arc<Inner<SpawnR, SleepR, TcpR, TlsR>>,
|
inner: Arc<Inner<SpawnR, SleepR, TcpR, TlsR>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
// We have to provide this ourselves, since derive(Clone) wrongly infers a
|
|
||||||
// `where S: Clone` bound (from the generic argument).
|
|
||||||
impl<SpawnR, SleepR, TcpR, TlsR> Clone for CompoundRuntime<SpawnR, SleepR, TcpR, TlsR> {
|
|
||||||
fn clone(&self) -> Self {
|
|
||||||
Self {
|
|
||||||
inner: Arc::clone(&self.inner),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A collection of objects implementing that traits that make up a [`Runtime`]
|
/// A collection of objects implementing that traits that make up a [`Runtime`]
|
||||||
struct Inner<SpawnR, SleepR, TcpR, TlsR> {
|
struct Inner<SpawnR, SleepR, TcpR, TlsR> {
|
||||||
/// A `Spawn` and `BlockOn` implementation.
|
/// A `Spawn` and `BlockOn` implementation.
|
||||||
|
|
Loading…
Reference in New Issue