1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-08-31 10:46:58 +02:00

use service types for ssl connectors

This commit is contained in:
Nikolay Kim
2019-11-18 20:20:56 +06:00
parent 1354946460
commit 877f89eeb7
2 changed files with 20 additions and 21 deletions

View File

@@ -33,13 +33,7 @@ where
T: Address + Unpin,
U: AsyncRead + AsyncWrite + Unpin + fmt::Debug,
{
pub fn service(
connector: Arc<ClientConfig>,
) -> impl Service<
Request = Connection<T, U>,
Response = Connection<T, TlsStream<U>>,
Error = std::io::Error,
> {
pub fn service(connector: Arc<ClientConfig>) -> RustlsConnectorService<T, U> {
RustlsConnectorService {
connector: connector,
_t: PhantomData,
@@ -81,6 +75,15 @@ pub struct RustlsConnectorService<T, U> {
_t: PhantomData<(T, U)>,
}
impl<T, U> Clone for RustlsConnectorService<T, U> {
fn clone(&self) -> Self {
Self {
connector: self.connector.clone(),
_t: PhantomData,
}
}
}
impl<T: Address + Unpin, U> Service for RustlsConnectorService<T, U>
where
U: AsyncRead + AsyncWrite + Unpin + fmt::Debug,