Expand description
Types used to send and receive primitives between a Thrift client and server.
Examples
Create and use a TInputProtocol.
use thrift::protocol::{TBinaryInputProtocol, TInputProtocol};
use thrift::transport::TTcpChannel;
// create the I/O channel
let mut channel = TTcpChannel::new();
channel.open("127.0.0.1:9090").unwrap();
// create the protocol to decode bytes into types
let mut protocol = TBinaryInputProtocol::new(channel, true);
// read types from the wire
let field_identifier = protocol.read_field_begin().unwrap();
let field_contents = protocol.read_string().unwrap();
let field_end = protocol.read_field_end().unwrap();Create and use a TOutputProtocol.
use thrift::protocol::{TBinaryOutputProtocol, TFieldIdentifier, TOutputProtocol, TType};
use thrift::transport::TTcpChannel;
// create the I/O channel
let mut channel = TTcpChannel::new();
channel.open("127.0.0.1:9090").unwrap();
// create the protocol to encode types into bytes
let mut protocol = TBinaryOutputProtocol::new(channel, true);
// write types
protocol.write_field_begin(&TFieldIdentifier::new("string_thing", TType::String, 1)).unwrap();
protocol.write_string("foo").unwrap();
protocol.write_field_end().unwrap();Structs
- Read messages encoded in the Thrift simple binary encoding.
- Factory for creating instances of
TBinaryInputProtocol. - Write messages using the Thrift simple binary encoding.
- Factory for creating instances of
TBinaryOutputProtocol. - Read messages encoded in the Thrift compact protocol.
- Factory for creating instances of
TCompactInputProtocol. - Write messages using the Thrift compact protocol.
- Factory for creating instances of
TCompactOutputProtocol. - Thrift field identifier.
- Thrift list identifier.
- Thrift map identifier.
- Thrift message identifier.
TOutputProtocolthat prefixes the service name to all outgoing Thrift messages.- Thrift set identifier.
TInputProtocolrequired to use aTMultiplexedProcessor.- Thrift struct identifier.
Enums
- Thrift message types.
- Thrift struct-field types.
Traits
- Converts a stream of bytes into Thrift identifiers, primitives, containers, or structs.
- Helper type used by servers to create
TInputProtocolinstances for accepted client connections. - Converts Thrift identifiers, primitives, containers or structs into a stream of bytes.
- Helper type used by servers to create
TOutputProtocolinstances for accepted client connections.
Functions
- Extract the field id from a Thrift field identifier.
- Compare the expected message type
expectedwith the received message typeactual. - Compare the expected message sequence number
expectedwith the received message sequence numberactual. - Compare the expected service-call name
expectedwith the received service-call nameactual. - Check if a required Thrift struct field exists.