THRIFT-5158 Update Rust generator and Rust lib,test,tutorial to only support 2018 edition
Client: rs
Patch: Allen George
This closes #2078
diff --git a/test/rs/src/bin/test_client.rs b/test/rs/src/bin/test_client.rs
index 5983c7d..3206deb 100644
--- a/test/rs/src/bin/test_client.rs
+++ b/test/rs/src/bin/test_client.rs
@@ -110,10 +110,10 @@
transport: &str,
protocol: &str,
service_name: &str,
-) -> thrift::Result<(Box<TInputProtocol>, Box<TOutputProtocol>)> {
+) -> thrift::Result<(Box<dyn TInputProtocol>, Box<dyn TOutputProtocol>)> {
let (i_chan, o_chan) = tcp_channel(host, port)?;
- let (i_tran, o_tran): (Box<TReadTransport>, Box<TWriteTransport>) = match transport {
+ let (i_tran, o_tran): (Box<dyn TReadTransport>, Box<dyn TWriteTransport>) = match transport {
"buffered" => {
(Box::new(TBufferedReadTransport::new(i_chan)),
Box::new(TBufferedWriteTransport::new(o_chan)))
@@ -125,7 +125,7 @@
unmatched => return Err(format!("unsupported transport {}", unmatched).into()),
};
- let (i_prot, o_prot): (Box<TInputProtocol>, Box<TOutputProtocol>) = match protocol {
+ let (i_prot, o_prot): (Box<dyn TInputProtocol>, Box<dyn TOutputProtocol>) = match protocol {
"binary" => {
(Box::new(TBinaryInputProtocol::new(i_tran, true)),
Box::new(TBinaryOutputProtocol::new(o_tran, true)))
@@ -164,8 +164,8 @@
c.split()
}
-type BuildThriftTestClient = ThriftTestSyncClient<Box<TInputProtocol>, Box<TOutputProtocol>>;
-type BuiltSecondServiceClient = SecondServiceSyncClient<Box<TInputProtocol>, Box<TOutputProtocol>>;
+type BuildThriftTestClient = ThriftTestSyncClient<Box<dyn TInputProtocol>, Box<dyn TOutputProtocol>>;
+type BuiltSecondServiceClient = SecondServiceSyncClient<Box<dyn TInputProtocol>, Box<dyn TOutputProtocol>>;
#[cfg_attr(feature = "cargo-clippy", allow(cyclomatic_complexity))]
fn make_thrift_calls(
diff --git a/test/rs/src/bin/test_server.rs b/test/rs/src/bin/test_server.rs
index d87ef75..e57cc14 100644
--- a/test/rs/src/bin/test_server.rs
+++ b/test/rs/src/bin/test_server.rs
@@ -80,8 +80,8 @@
info!("binding to {}", listen_address);
- let (i_transport_factory, o_transport_factory): (Box<TReadTransportFactory>,
- Box<TWriteTransportFactory>) =
+ let (i_transport_factory, o_transport_factory): (Box<dyn TReadTransportFactory>,
+ Box<dyn TWriteTransportFactory>) =
match &*transport {
"buffered" => {
(Box::new(TBufferedReadTransportFactory::new()),
@@ -96,8 +96,8 @@
}
};
- let (i_protocol_factory, o_protocol_factory): (Box<TInputProtocolFactory>,
- Box<TOutputProtocolFactory>) =
+ let (i_protocol_factory, o_protocol_factory): (Box<dyn TInputProtocolFactory>,
+ Box<dyn TOutputProtocolFactory>) =
match &*protocol {
"binary" | "multi" | "multi:binary" => {
(Box::new(TBinaryInputProtocolFactory::new()),
diff --git a/test/rs/src/lib.rs b/test/rs/src/lib.rs
index 479bf90..10523f0 100644
--- a/test/rs/src/lib.rs
+++ b/test/rs/src/lib.rs
@@ -20,4 +20,4 @@
extern crate try_from;
mod thrift_test;
-pub use thrift_test::*;
+pub use crate::thrift_test::*;