Allen George | 8b96bfb | 2016-11-02 08:01:08 -0400 | [diff] [blame] | 1 | // Licensed to the Apache Software Foundation (ASF) under one |
| 2 | // or more contributor license agreements. See the NOTICE file |
| 3 | // distributed with this work for additional information |
| 4 | // regarding copyright ownership. The ASF licenses this file |
| 5 | // to you under the Apache License, Version 2.0 (the |
| 6 | // "License"); you may not use this file except in compliance |
| 7 | // with the License. You may obtain a copy of the License at |
| 8 | // |
| 9 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | // |
| 11 | // Unless required by applicable law or agreed to in writing, |
| 12 | // software distributed under the License is distributed on an |
| 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | // KIND, either express or implied. See the License for the |
| 15 | // specific language governing permissions and limitations |
| 16 | // under the License. |
| 17 | |
| 18 | //! Thrift compiler auto-generated support. |
| 19 | //! |
| 20 | //! |
| 21 | //! Types and functions used internally by the Thrift compiler's Rust plugin |
| 22 | //! to implement required functionality. Users should never have to use code |
| 23 | //! in this module directly. |
| 24 | |
Allen George | 0e22c36 | 2017-01-30 07:15:00 -0500 | [diff] [blame] | 25 | use protocol::{TInputProtocol, TOutputProtocol}; |
Allen George | 8b96bfb | 2016-11-02 08:01:08 -0400 | [diff] [blame] | 26 | |
| 27 | /// Specifies the minimum functionality an auto-generated client should provide |
| 28 | /// to communicate with a Thrift server. |
| 29 | pub trait TThriftClient { |
| 30 | /// Returns the input protocol used to read serialized Thrift messages |
| 31 | /// from the Thrift server. |
Danny Browning | 77d96c1 | 2019-08-21 13:41:07 -0600 | [diff] [blame] | 32 | fn i_prot_mut(&mut self) -> &mut dyn TInputProtocol; |
Allen George | 8b96bfb | 2016-11-02 08:01:08 -0400 | [diff] [blame] | 33 | /// Returns the output protocol used to write serialized Thrift messages |
| 34 | /// to the Thrift server. |
Danny Browning | 77d96c1 | 2019-08-21 13:41:07 -0600 | [diff] [blame] | 35 | fn o_prot_mut(&mut self) -> &mut dyn TOutputProtocol; |
Allen George | 8b96bfb | 2016-11-02 08:01:08 -0400 | [diff] [blame] | 36 | /// Returns the sequence number of the last message written to the Thrift |
| 37 | /// server. Returns `0` if no messages have been written. Sequence |
| 38 | /// numbers should *never* be negative, and this method returns an `i32` |
| 39 | /// simply because the Thrift protocol encodes sequence numbers as `i32` on |
| 40 | /// the wire. |
| 41 | fn sequence_number(&self) -> i32; // FIXME: consider returning a u32 |
| 42 | /// Increments the sequence number, indicating that a message with that |
| 43 | /// number has been sent to the Thrift server. |
| 44 | fn increment_sequence_number(&mut self) -> i32; |
| 45 | } |