You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@thrift.apache.org by GitBox <gi...@apache.org> on 2021/08/01 16:40:20 UTC

[GitHub] [thrift] jorgecarleitao commented on a change in pull request #2426: THRIFT-5446: Added code-gen for rust async read.

jorgecarleitao commented on a change in pull request #2426:
URL: https://github.com/apache/thrift/pull/2426#discussion_r680535842



##########
File path: lib/rs/src/protocol/compact_stream.rs
##########
@@ -0,0 +1,301 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::convert::{From, TryFrom};
+use std::io;
+
+use byteorder::LittleEndian;
+use futures::{AsyncRead, AsyncReadExt, AsyncSeek, AsyncSeekExt};
+use integer_encoding::reader::VarIntAsyncReader;
+
+use super::compact::collection_u8_to_type;
+use super::{
+    TFieldIdentifier, TInputProtocol, TInputStreamProtocol, TListIdentifier, TMapIdentifier,
+    TMessageIdentifier, TMessageType,
+};
+use super::{TSetIdentifier, TStructIdentifier, TType};
+
+const COMPACT_PROTOCOL_ID: u8 = 0x82;
+const COMPACT_VERSION: u8 = 0x01;
+const COMPACT_VERSION_MASK: u8 = 0x1F;
+
+#[derive(Debug)]
+pub struct TCompactInputStreamProtocol<T: AsyncRead + Unpin + Send> {

Review comment:
       I think we can re-use the same struct and only need to specialize when implementing the trait, for now I just wanted the full flexibility, we can clean it up at the end.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@thrift.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org