Skip to content

Commit ed9b887

Browse files
committed
add boxed connector
1 parent 7e10b77 commit ed9b887

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

src/connector.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,22 @@ where
8686
}
8787
}
8888

89+
/// Use custom boxed connector
90+
pub fn boxed_connector<U>(
91+
self,
92+
connector: U,
93+
) -> RedisConnector<A, U>
94+
where
95+
U: Service<Request = Connect<A>, Response = IoBoxed, Error = connect::ConnectError>,
96+
{
97+
RedisConnector {
98+
connector,
99+
address: self.address,
100+
passwords: self.passwords,
101+
pool: self.pool,
102+
}
103+
}
104+
89105
#[cfg(feature = "openssl")]
90106
/// Use openssl connector.
91107
pub fn openssl(

src/lib.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ pub mod codec;
3535
mod connector;
3636
pub mod errors;
3737
mod simple;
38-
// mod transport;
3938

4039
pub use self::client::{Client, CommandResult};
4140
pub use self::connector::RedisConnector;
@@ -79,10 +78,6 @@ pub fn gen_random_key() -> String {
7978
use rand::distributions::Alphanumeric;
8079
use rand::{thread_rng, Rng};
8180

82-
let key: String = thread_rng()
83-
.sample_iter(&Alphanumeric)
84-
.take(12)
85-
.map(char::from)
86-
.collect();
81+
let key: String = thread_rng().sample_iter(&Alphanumeric).take(12).map(char::from).collect();
8782
key
8883
}

0 commit comments

Comments
 (0)