This library provides a way easily to implement Connection Pools for any [thrift::TThriftClient
],
which can then be used alongside [bb8
] and/or [r2d2
]
```rust use thrift::protocol::{TCompactInputProtocol, TCompactOutputProtocol, TInputProtocol, TOutputProtocol}; use thrift::transport::{ ReadHalf, TFramedReadTransport, TFramedWriteTransport, TTcpChannel, WriteHalf, }; use thrift_pool::{MakeThriftConnectionFromAddrs, 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 =
MakeThriftConnectionFromAddrs::
```