blob: 54d4080e82b1b18590a8ed838aabc478ac2f7c6c [file] [log] [blame]
Allen George8b96bfb2016-11-02 08:01:08 -04001// 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 George0e22c362017-01-30 07:15:00 -050025use protocol::{TInputProtocol, TOutputProtocol};
Allen George8b96bfb2016-11-02 08:01:08 -040026
27/// Specifies the minimum functionality an auto-generated client should provide
28/// to communicate with a Thrift server.
29pub trait TThriftClient {
30 /// Returns the input protocol used to read serialized Thrift messages
31 /// from the Thrift server.
32 fn i_prot_mut(&mut self) -> &mut TInputProtocol;
33 /// Returns the output protocol used to write serialized Thrift messages
34 /// to the Thrift server.
35 fn o_prot_mut(&mut self) -> &mut TOutputProtocol;
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}