1
1
use std:: future:: Future ;
2
2
3
3
use ntex:: connect:: { self , Address , Connect , Connector } ;
4
- use ntex:: io:: { Filter , Io , IoBoxed } ;
4
+ use ntex:: io:: { Boxed , IoBoxed } ;
5
5
use ntex:: { service:: Service , time:: Seconds , util:: ByteString , util:: PoolId , util:: PoolRef } ;
6
6
7
7
#[ cfg( feature = "openssl" ) ]
@@ -27,16 +27,11 @@ where
27
27
{
28
28
#[ allow( clippy:: new_ret_no_self) ]
29
29
/// Create new redis connector
30
- pub fn new (
31
- address : A ,
32
- ) -> RedisConnector <
33
- A ,
34
- impl Service < Connect < A > , Response = IoBoxed , Error = connect:: ConnectError > ,
35
- > {
30
+ pub fn new ( address : A ) -> RedisConnector < A , Boxed < Connector < A > , Connect < A > > > {
36
31
RedisConnector {
37
32
address,
38
33
passwords : Vec :: new ( ) ,
39
- connector : Connector :: default ( ) . map ( |io| io . seal ( ) ) ,
34
+ connector : Connector :: default ( ) . seal ( ) ,
40
35
pool : PoolId :: P7 . pool_ref ( ) ,
41
36
}
42
37
}
@@ -67,32 +62,19 @@ where
67
62
}
68
63
69
64
/// Use custom connector
70
- pub fn connector < U , F > (
65
+ pub fn connector < Io , U > (
71
66
self ,
72
67
connector : U ,
73
68
) -> RedisConnector <
74
69
A ,
75
70
impl Service < Connect < A > , Response = IoBoxed , Error = connect:: ConnectError > ,
76
71
>
77
72
where
78
- F : Filter ,
79
- U : Service < Connect < A > , Response = Io < F > , Error = connect :: ConnectError > ,
73
+ U : Service < Connect < A > , Response = Io , Error = connect :: ConnectError > ,
74
+ IoBoxed : From < Io > ,
80
75
{
81
76
RedisConnector {
82
- connector : connector. map ( |io| io. seal ( ) ) ,
83
- address : self . address ,
84
- passwords : self . passwords ,
85
- pool : self . pool ,
86
- }
87
- }
88
-
89
- /// Use custom boxed connector
90
- pub fn boxed_connector < U > ( self , connector : U ) -> RedisConnector < A , U >
91
- where
92
- U : Service < Connect < A > , Response = IoBoxed , Error = connect:: ConnectError > ,
93
- {
94
- RedisConnector {
95
- connector,
77
+ connector : connector. map ( |io| IoBoxed :: from ( io) ) ,
96
78
address : self . address ,
97
79
passwords : self . passwords ,
98
80
pool : self . pool ,
@@ -104,14 +86,11 @@ where
104
86
pub fn openssl (
105
87
self ,
106
88
connector : SslConnector ,
107
- ) -> RedisConnector <
108
- A ,
109
- impl Service < Connect < A > , Response = IoBoxed , Error = connect:: ConnectError > ,
110
- > {
89
+ ) -> RedisConnector < A , Boxed < openssl:: Connector < A > , Connect < A > > > {
111
90
RedisConnector {
112
91
address : self . address ,
113
92
passwords : self . passwords ,
114
- connector : openssl:: Connector :: new ( connector) . map ( |io| io . into_boxed ( ) ) ,
93
+ connector : openssl:: Connector :: new ( connector) . seal ( ) ,
115
94
pool : self . pool ,
116
95
}
117
96
}
@@ -128,7 +107,7 @@ where
128
107
RedisConnector {
129
108
address : self . address ,
130
109
passwords : self . passwords ,
131
- connector : rustls:: Connector :: new ( config) . map ( |io| io . into_boxed ( ) ) ,
110
+ connector : rustls:: Connector :: new ( config) . map ( |io| IoBoxed :: from ( io ) ) ,
132
111
pool : self . pool ,
133
112
}
134
113
}
0 commit comments