THRIFT-2945 Add Rust support Client: Rust Patch: Allen George <[email protected]>
This closes #1147 Project: http://git-wip-us.apache.org/repos/asf/thrift/repo Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/8b96bfbf Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/8b96bfbf Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/8b96bfbf Branch: refs/heads/master Commit: 8b96bfbf1eb058d3c378535e90c1e90280224bb4 Parents: 6fe7fa1 Author: Allen George <[email protected]> Authored: Wed Nov 2 08:01:08 2016 -0400 Committer: Jens Geyer <[email protected]> Committed: Thu Jan 26 01:34:16 2017 +0100 ---------------------------------------------------------------------- .gitignore | 23 + Makefile.am | 2 +- compiler/cpp/CMakeLists.txt | 1 + compiler/cpp/Makefile.am | 3 +- compiler/cpp/compiler.vcxproj | 1 + compiler/cpp/compiler.vcxproj.filters | 5 +- .../cpp/src/thrift/generate/t_rs_generator.cc | 3164 ++++++++++++++++++ configure.ac | 38 + lib/Makefile.am | 4 + lib/rs/Cargo.toml | 18 + lib/rs/Makefile.am | 46 + lib/rs/README.md | 60 + lib/rs/src/autogen.rs | 45 + lib/rs/src/errors.rs | 678 ++++ lib/rs/src/lib.rs | 87 + lib/rs/src/protocol/binary.rs | 817 +++++ lib/rs/src/protocol/compact.rs | 2085 ++++++++++++ lib/rs/src/protocol/mod.rs | 709 ++++ lib/rs/src/protocol/multiplexed.rs | 219 ++ lib/rs/src/protocol/stored.rs | 191 ++ lib/rs/src/server/mod.rs | 95 + lib/rs/src/server/multiplexed.rs | 92 + lib/rs/src/server/simple.rs | 189 ++ lib/rs/src/transport/buffered.rs | 400 +++ lib/rs/src/transport/framed.rs | 187 ++ lib/rs/src/transport/mem.rs | 342 ++ lib/rs/src/transport/mod.rs | 51 + lib/rs/src/transport/passthru.rs | 73 + lib/rs/src/transport/socket.rs | 141 + lib/rs/test/Cargo.toml | 15 + lib/rs/test/Makefile.am | 49 + lib/rs/test/src/bin/kitchen_sink_client.rs | 142 + lib/rs/test/src/bin/kitchen_sink_server.rs | 225 ++ lib/rs/test/src/lib.rs | 53 + lib/rs/test/thrifts/Base_One.thrift | 62 + lib/rs/test/thrifts/Base_Two.thrift | 44 + lib/rs/test/thrifts/Midlayer.thrift | 62 + lib/rs/test/thrifts/Ultimate.thrift | 49 + test/Makefile.am | 6 + test/rs/Cargo.toml | 15 + test/rs/Makefile.am | 42 + test/rs/src/bin/test_client.rs | 500 +++ test/rs/src/bin/test_server.rs | 337 ++ test/rs/src/lib.rs | 23 + test/tests.json | 26 + tutorial/Makefile.am | 4 + tutorial/rs/Cargo.toml | 16 + tutorial/rs/Makefile.am | 52 + tutorial/rs/README.md | 330 ++ tutorial/rs/src/bin/tutorial_client.rs | 136 + tutorial/rs/src/bin/tutorial_server.rs | 168 + tutorial/rs/src/lib.rs | 23 + 52 files changed, 12142 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/thrift/blob/8b96bfbf/.gitignore ---------------------------------------------------------------------- diff --git a/.gitignore b/.gitignore index 9d2463e..0a98a13 100644 --- a/.gitignore +++ b/.gitignore @@ -261,6 +261,17 @@ project.lock.json /lib/erl/logs/ /lib/go/test/gopath/ /lib/go/test/ThriftTest.thrift +/lib/rs/target/ +/lib/rs/Cargo.lock +/lib/rs/test/Cargo.lock +/lib/rs/test/target/ +/lib/rs/test/bin/ +/lib/rs/test/src/base_one.rs +/lib/rs/test/src/base_two.rs +/lib/rs/test/src/midlayer.rs +/lib/rs/test/src/ultimate.rs +/lib/rs/*.iml +/lib/rs/**/*.iml /libtool /ltmain.sh /missing @@ -300,6 +311,12 @@ project.lock.json /test/netcore/**/obj /test/netcore/**/gen-* /test/netcore/Thrift +/test/rs/Cargo.lock +/test/rs/src/thrift_test.rs +/test/rs/bin/ +/test/rs/target/ +/test/rs/*.iml +/test/rs/**/*.iml /tutorial/cpp/TutorialClient /tutorial/cpp/TutorialServer /tutorial/c_glib/tutorial_client @@ -338,4 +355,10 @@ project.lock.json /tutorial/netcore/**/obj /tutorial/netcore/**/gen-* /tutorial/netcore/Thrift +/tutorial/rs/*.iml +/tutorial/rs/src/shared.rs +/tutorial/rs/src/tutorial.rs +/tutorial/rs/bin +/tutorial/rs/target +/tutorial/rs/Cargo.lock /ylwrap http://git-wip-us.apache.org/repos/asf/thrift/blob/8b96bfbf/Makefile.am ---------------------------------------------------------------------- diff --git a/Makefile.am b/Makefile.am index ed58265..89a0adc 100755 --- a/Makefile.am +++ b/Makefile.am @@ -54,7 +54,7 @@ empty := space := $(empty) $(empty) comma := , -CROSS_LANGS = @MAYBE_CPP@ @MAYBE_C_GLIB@ @MAYBE_D@ @MAYBE_JAVA@ @MAYBE_CSHARP@ @MAYBE_PYTHON@ @MAYBE_PY3@ @MAYBE_RUBY@ @MAYBE_HASKELL@ @MAYBE_PERL@ @MAYBE_PHP@ @MAYBE_GO@ @MAYBE_NODEJS@ @MAYBE_DART@ @MAYBE_ERLANG@ @MAYBE_LUA@ +CROSS_LANGS = @MAYBE_CPP@ @MAYBE_C_GLIB@ @MAYBE_D@ @MAYBE_JAVA@ @MAYBE_CSHARP@ @MAYBE_PYTHON@ @MAYBE_PY3@ @MAYBE_RUBY@ @MAYBE_HASKELL@ @MAYBE_PERL@ @MAYBE_PHP@ @MAYBE_GO@ @MAYBE_NODEJS@ @MAYBE_DART@ @MAYBE_ERLANG@ @MAYBE_LUA@ @MAYBE_RS@ CROSS_LANGS_COMMA_SEPARATED = $(subst $(space),$(comma),$(CROSS_LANGS)) if WITH_PY3 http://git-wip-us.apache.org/repos/asf/thrift/blob/8b96bfbf/compiler/cpp/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/compiler/cpp/CMakeLists.txt b/compiler/cpp/CMakeLists.txt index 9f7585d..8e861e4 100644 --- a/compiler/cpp/CMakeLists.txt +++ b/compiler/cpp/CMakeLists.txt @@ -101,6 +101,7 @@ THRIFT_ADD_COMPILER(go "Enable compiler for Go" ON) THRIFT_ADD_COMPILER(d "Enable compiler for D" ON) THRIFT_ADD_COMPILER(lua "Enable compiler for Lua" ON) THRIFT_ADD_COMPILER(gv "Enable compiler for GraphViz" ON) +THRIFT_ADD_COMPILER(rs "Enable compiler for Rust" ON) THRIFT_ADD_COMPILER(xml "Enable compiler for XML" ON) # Thrift is looking for include files in the src directory http://git-wip-us.apache.org/repos/asf/thrift/blob/8b96bfbf/compiler/cpp/Makefile.am ---------------------------------------------------------------------- diff --git a/compiler/cpp/Makefile.am b/compiler/cpp/Makefile.am index 5d424b4..5082033 100644 --- a/compiler/cpp/Makefile.am +++ b/compiler/cpp/Makefile.am @@ -107,7 +107,8 @@ thrift_SOURCES += src/thrift/generate/t_c_glib_generator.cc \ src/thrift/generate/t_go_generator.cc \ src/thrift/generate/t_gv_generator.cc \ src/thrift/generate/t_d_generator.cc \ - src/thrift/generate/t_lua_generator.cc + src/thrift/generate/t_lua_generator.cc \ + src/thrift/generate/t_rs_generator.cc thrift_CPPFLAGS = -I$(srcdir)/src thrift_CXXFLAGS = -Wall -Wextra -pedantic http://git-wip-us.apache.org/repos/asf/thrift/blob/8b96bfbf/compiler/cpp/compiler.vcxproj ---------------------------------------------------------------------- diff --git a/compiler/cpp/compiler.vcxproj b/compiler/cpp/compiler.vcxproj index 1e86360..4b03253 100644 --- a/compiler/cpp/compiler.vcxproj +++ b/compiler/cpp/compiler.vcxproj @@ -79,6 +79,7 @@ <ClCompile Include="src\thrift\generate\t_php_generator.cc" /> <ClCompile Include="src\thrift\generate\t_py_generator.cc" /> <ClCompile Include="src\thrift\generate\t_rb_generator.cc" /> + <ClCompile Include="src\thrift\generate\t_rs_generator.cc" /> <ClCompile Include="src\thrift\generate\t_st_generator.cc" /> <ClCompile Include="src\thrift\generate\t_swift_generator.cc" /> <ClCompile Include="src\thrift\generate\t_xml_generator.cc" /> http://git-wip-us.apache.org/repos/asf/thrift/blob/8b96bfbf/compiler/cpp/compiler.vcxproj.filters ---------------------------------------------------------------------- diff --git a/compiler/cpp/compiler.vcxproj.filters b/compiler/cpp/compiler.vcxproj.filters index 9b14bbf..b96865b 100644 --- a/compiler/cpp/compiler.vcxproj.filters +++ b/compiler/cpp/compiler.vcxproj.filters @@ -161,6 +161,9 @@ <ClCompile Include="src\generate\t_rb_generator.cc"> <Filter>generate</Filter> </ClCompile> + <ClCompile Include="src\generate\t_rs_generator.cc"> + <Filter>generate</Filter> + </ClCompile> <ClCompile Include="src\generate\t_st_generator.cc"> <Filter>generate</Filter> </ClCompile> @@ -193,4 +196,4 @@ <None Include="src\thriftl.ll" /> <None Include="src\thrifty.yy" /> </ItemGroup> -</Project> \ No newline at end of file +</Project>
