This library provides a simple way implement bb8
and/or r2d2
Connection Pools
for any TThriftClient
```rust use thrift::protocol::{TCompactInputProtocol, TCompactOutputProtocol, TInputProtocol, TOutputProtocol}; use thrift::transport::{ ReadHalf, TFramedReadTransport, TFramedWriteTransport, TTcpChannel, WriteHalf, }; use thrift_pool::{MakeThriftConnectionFromAddrs, ThriftConnectionManager, ThriftConnection, FromProtocol}; use r2d2::Pool;
struct MyThriftClient
impl
type OutputProtocol = Op;
fn from_protocol(
input_protocol: Self::InputProtocol,
output_protocol: Self::OutputProtocol,
) -> Self {
MyThriftClient {
i_prot: input_protocol,
o_prot: output_protocol,
}
}
}
impl
type Client = MyThriftClient<
TCompactInputProtocol
;
let manager = ThriftConnectionManager::new(
MakeThriftConnectionFromAddrs::
```