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§
- TBinary
Input Protocol - Read messages encoded in the Thrift simple binary encoding.
- TBinary
Input Protocol Factory - Factory for creating instances of
TBinaryInputProtocol
. - TBinary
Output Protocol - Write messages using the Thrift simple binary encoding.
- TBinary
Output Protocol Factory - Factory for creating instances of
TBinaryOutputProtocol
. - TCompact
Input Protocol - Read messages encoded in the Thrift compact protocol.
- TCompact
Input Protocol Factory - Factory for creating instances of
TCompactInputProtocol
. - TCompact
Output Protocol - Write messages using the Thrift compact protocol.
- TCompact
Output Protocol Factory - Factory for creating instances of
TCompactOutputProtocol
. - TField
Identifier - Thrift field identifier.
- TList
Identifier - Thrift list identifier.
- TMap
Identifier - Thrift map identifier.
- TMessage
Identifier - Thrift message identifier.
- TMultiplexed
Output Protocol TOutputProtocol
that prefixes the service name to all outgoing Thrift messages.- TSet
Identifier - Thrift set identifier.
- TStored
Input Protocol TInputProtocol
required to use aTMultiplexedProcessor
.- TStruct
Identifier - Thrift struct identifier.
Enums§
- TMessage
Type - Thrift message types.
- TType
- Thrift struct-field types.
Traits§
- TInput
Protocol - Converts a stream of bytes into Thrift identifiers, primitives, containers, or structs.
- TInput
Protocol Factory - Helper type used by servers to create
TInputProtocol
instances for accepted client connections. - TOutput
Protocol - Converts Thrift identifiers, primitives, containers or structs into a stream of bytes.
- TOutput
Protocol Factory - Helper type used by servers to create
TOutputProtocol
instances for accepted client connections. - TSerializable
- Reads and writes the struct to Thrift protocols.
Functions§
- field_
id - Extract the field id from a Thrift field identifier.
- verify_
expected_ message_ type - Compare the expected message type
expected
with the received message typeactual
. - verify_
expected_ sequence_ number - Compare the expected message sequence number
expected
with the received message sequence numberactual
. - verify_
expected_ service_ call - Compare the expected service-call name
expected
with the received service-call nameactual
. - verify_
required_ field_ exists - Check if a required Thrift struct field exists.