summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAllen George <allen.george@gmail.com>2020-03-29 11:48:55 -0400
committerJens Geyer <jensg@apache.org>2020-09-02 09:03:40 +0200
commitb0d14133d5071370905a1b54b37a1a7c86d50e6d (patch)
tree517583f4bb61da82195f237c3663cac3f259e1bc /test
parent935770c6b077fd96430684049078bdb9bdff50c5 (diff)
downloadthrift-b0d14133d5071370905a1b54b37a1a7c86d50e6d.tar.gz
THRIFT-5158 Update Rust generator and Rust lib,test,tutorial to only support 2018 edition
Client: rs Patch: Allen George This closes #2078
Diffstat (limited to 'test')
-rw-r--r--test/rs/Cargo.toml1
-rw-r--r--test/rs/src/bin/test_client.rs10
-rw-r--r--test/rs/src/bin/test_server.rs8
-rw-r--r--test/rs/src/lib.rs2
4 files changed, 11 insertions, 10 deletions
diff --git a/test/rs/Cargo.toml b/test/rs/Cargo.toml
index c1058f91f..deffd2178 100644
--- a/test/rs/Cargo.toml
+++ b/test/rs/Cargo.toml
@@ -1,6 +1,7 @@
[package]
name = "thrift-test"
version = "0.1.0"
+edition = "2018"
license = "Apache-2.0"
authors = ["Apache Thrift Developers <dev@thrift.apache.org>"]
publish = false
diff --git a/test/rs/src/bin/test_client.rs b/test/rs/src/bin/test_client.rs
index 5983c7db5..3206deb44 100644
--- a/test/rs/src/bin/test_client.rs
+++ b/test/rs/src/bin/test_client.rs
@@ -110,10 +110,10 @@ fn build_protocols(
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 @@ fn build_protocols(
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 @@ fn tcp_channel(
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 d87ef7527..e57cc14cb 100644
--- a/test/rs/src/bin/test_server.rs
+++ b/test/rs/src/bin/test_server.rs
@@ -80,8 +80,8 @@ fn run() -> thrift::Result<()> {
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 @@ fn run() -> thrift::Result<()> {
}
};
- 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 479bf9051..10523f0a5 100644
--- a/test/rs/src/lib.rs
+++ b/test/rs/src/lib.rs
@@ -20,4 +20,4 @@ extern crate thrift;
extern crate try_from;
mod thrift_test;
-pub use thrift_test::*;
+pub use crate::thrift_test::*;