Skip to main content

TInputProtocol

Trait TInputProtocol 

Source
pub trait TInputProtocol {
Show 23 methods // Required methods fn read_message_begin(&mut self) -> Result<TMessageIdentifier>; fn read_message_end(&mut self) -> Result<()>; fn read_struct_begin(&mut self) -> Result<Option<TStructIdentifier>>; fn read_struct_end(&mut self) -> Result<()>; fn read_field_begin(&mut self) -> Result<TFieldIdentifier>; fn read_field_end(&mut self) -> Result<()>; fn read_bool(&mut self) -> Result<bool>; fn read_bytes(&mut self) -> Result<Vec<u8>>; fn read_i8(&mut self) -> Result<i8>; fn read_i16(&mut self) -> Result<i16>; fn read_i32(&mut self) -> Result<i32>; fn read_i64(&mut self) -> Result<i64>; fn read_double(&mut self) -> Result<f64>; fn read_string(&mut self) -> Result<String>; fn read_list_begin(&mut self) -> Result<TListIdentifier>; fn read_list_end(&mut self) -> Result<()>; fn read_set_begin(&mut self) -> Result<TSetIdentifier>; fn read_set_end(&mut self) -> Result<()>; fn read_map_begin(&mut self) -> Result<TMapIdentifier>; fn read_map_end(&mut self) -> Result<()>; fn read_byte(&mut self) -> Result<u8>; // Provided methods fn skip(&mut self, field_type: TType) -> Result<()> { ... } fn skip_till_depth( &mut self, field_type: TType, remaining_depth: i8, ) -> Result<()> { ... }
}
Expand description

Contains the minimum set of functions necessary to read a Thrift service call, primitive or container from the wire.

This trait does not deal with higher-level types like structs or exceptions

  • only with primitives, message or container boundaries. Once read the data is returned either as an identifier (for example TMessageIdentifier) or as the primitive itself.

All methods return a rift::Result. If a method returns an Err the underlying transport or protocol should be considered suspect, and the channel should be terminated.

§Examples

Using a TInputProtocol

use std::cell::RefCell;
use std::rc::Rc;

use rift::protocol::{TBinaryInputProtocol, TInputProtocol, TType};
use rift::transport::{TTcpTransport, TTransport};

let mut transport = TTcpTransport::new();
transport.open("127.0.0.1:9090");
let transport = Rc::new(RefCell::new(Box::new(transport) as Box<TTransport>));

let mut i_prot = TBinaryInputProtocol::new(true, transport.clone());

let field_identifier = i_prot.read_field_begin().unwrap();
let field_contents = i_prot.read_string().unwrap();
let field_end = i_prot.read_field_end().unwrap();

Required Methods§

Source

fn read_message_begin(&mut self) -> Result<TMessageIdentifier>

Read the beginning of a Thrift message from the wire.

Source

fn read_message_end(&mut self) -> Result<()>

Read the end of a Thrift message from the wire.

Source

fn read_struct_begin(&mut self) -> Result<Option<TStructIdentifier>>

Read the beginning of a Thrift struct from the wire.

Source

fn read_struct_end(&mut self) -> Result<()>

Read the end of a Thrift struct from the wire.

Source

fn read_field_begin(&mut self) -> Result<TFieldIdentifier>

Read the beginning of a Thrift struct field from the wire.

Source

fn read_field_end(&mut self) -> Result<()>

Read the end of a Thrift struct field from the wire.

Source

fn read_bool(&mut self) -> Result<bool>

Read a bool from the wire.

Source

fn read_bytes(&mut self) -> Result<Vec<u8>>

Read a fixed-length byte array from the wire.

Source

fn read_i8(&mut self) -> Result<i8>

Read a word from the wire.

Source

fn read_i16(&mut self) -> Result<i16>

Read a 16-bit signed integer from the wire.

Source

fn read_i32(&mut self) -> Result<i32>

Read a 32-bit signed integer from the wire.

Source

fn read_i64(&mut self) -> Result<i64>

Read a 64-bit signed integer from the wire.

Source

fn read_double(&mut self) -> Result<f64>

Read a 64-bit float from the wire.

Source

fn read_string(&mut self) -> Result<String>

Read a fixed-length string (not null terminated) from the wire.

Source

fn read_list_begin(&mut self) -> Result<TListIdentifier>

Read the beginning of a list from the wire.

Source

fn read_list_end(&mut self) -> Result<()>

Read the end of a list from the wire.

Source

fn read_set_begin(&mut self) -> Result<TSetIdentifier>

Read the beginning of a set from the wire.

Source

fn read_set_end(&mut self) -> Result<()>

Read the end of a set from the wire.

Source

fn read_map_begin(&mut self) -> Result<TMapIdentifier>

Read the beginning of a map from the wire.

Source

fn read_map_end(&mut self) -> Result<()>

Read the end of a map from the wire.

Source

fn read_byte(&mut self) -> Result<u8>

Read an unsigned byte from the wire.

This method should never be used in generated code.

Provided Methods§

Source

fn skip(&mut self, field_type: TType) -> Result<()>

Skip a field of type field_type recursively until MAXIMUM_SKIP_DEPTH is reached.

Source

fn skip_till_depth( &mut self, field_type: TType, remaining_depth: i8, ) -> Result<()>

Skip a field of type field_type recursively for remaining_depth levels.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§