Struct thrift::protocol::TBinaryInputProtocol
[−]
[src]
pub struct TBinaryInputProtocol { /* fields omitted */ }
Read messages encoded in the Thrift simple binary encoding.
There are two available modes: strict
and non-strict
, where the
non-strict
version does not check for the protocol version in the
received message header.
Examples
Create and use a TBinaryInputProtocol
.
use std::cell::RefCell; use std::rc::Rc; use thrift::protocol::{TBinaryInputProtocol, TInputProtocol}; use thrift::transport::{TTcpTransport, TTransport}; let mut transport = TTcpTransport::new(); transport.open("localhost:9090").unwrap(); let transport = Rc::new(RefCell::new(Box::new(transport) as Box<TTransport>)); let mut i_prot = TBinaryInputProtocol::new(transport, true); let recvd_bool = i_prot.read_bool().unwrap(); let recvd_string = i_prot.read_string().unwrap();
Methods
impl TBinaryInputProtocol
[src]
fn new(transport: Rc<RefCell<Box<TTransport>>>,
strict: bool)
-> TBinaryInputProtocol
strict: bool)
-> TBinaryInputProtocol
Create a TBinaryInputProtocol
that reads bytes from transport
.
Set strict
to true
if all incoming messages contain the protocol
version number in the protocol header.
Trait Implementations
impl TInputProtocol for TBinaryInputProtocol
[src]
fn read_message_begin(&mut self) -> Result<TMessageIdentifier>
Read the beginning of a Thrift message.
fn read_message_end(&mut self) -> Result<()>
Read the end of a Thrift message.
fn read_struct_begin(&mut self) -> Result<Option<TStructIdentifier>>
Read the beginning of a Thrift struct.
fn read_struct_end(&mut self) -> Result<()>
Read the end of a Thrift struct.
fn read_field_begin(&mut self) -> Result<TFieldIdentifier>
Read the beginning of a Thrift struct field.
fn read_field_end(&mut self) -> Result<()>
Read the end of a Thrift struct field.
fn read_bytes(&mut self) -> Result<Vec<u8>>
Read a fixed-length byte array.
fn read_bool(&mut self) -> Result<bool>
Read a bool.
fn read_i8(&mut self) -> Result<i8>
Read a word.
fn read_i16(&mut self) -> Result<i16>
Read a 16-bit signed integer.
fn read_i32(&mut self) -> Result<i32>
Read a 32-bit signed integer.
fn read_i64(&mut self) -> Result<i64>
Read a 64-bit signed integer.
fn read_double(&mut self) -> Result<f64>
Read a 64-bit float.
fn read_string(&mut self) -> Result<String>
Read a fixed-length string (not null terminated).
fn read_list_begin(&mut self) -> Result<TListIdentifier>
Read the beginning of a list.
fn read_list_end(&mut self) -> Result<()>
Read the end of a list.
fn read_set_begin(&mut self) -> Result<TSetIdentifier>
Read the beginning of a set.
fn read_set_end(&mut self) -> Result<()>
Read the end of a set.
fn read_map_begin(&mut self) -> Result<TMapIdentifier>
Read the beginning of a map.
fn read_map_end(&mut self) -> Result<()>
Read the end of a map.
fn read_byte(&mut self) -> Result<u8>
Read an unsigned byte. Read more
fn skip(&mut self, field_type: TType) -> Result<()>
Skip a field with type field_type
recursively until the default maximum skip depth is reached. Read more
fn skip_till_depth(&mut self, field_type: TType, depth: i8) -> Result<()>
Skip a field with type field_type
recursively up to depth
levels.