[−][src]Trait thrift::protocol::TInputProtocol
Converts a stream of bytes into Thrift identifiers, primitives, containers, or structs.
This trait does not deal with higher-level Thrift concepts like structs or
exceptions - only with primitives and message or container boundaries. Once
bytes are read they are deserialized and an identifier (for example
TMessageIdentifier
) or a primitive is returned.
All methods return a thrift::Result
. If an Err
is returned the protocol
instance and its underlying transport should be terminated.
Examples
Create and use a TInputProtocol
use thrift::protocol::{TBinaryInputProtocol, TInputProtocol}; use thrift::transport::TTcpChannel; let mut channel = TTcpChannel::new(); channel.open("127.0.0.1:9090").unwrap(); let mut protocol = TBinaryInputProtocol::new(channel, true); let field_identifier = protocol.read_field_begin().unwrap(); let field_contents = protocol.read_string().unwrap(); let field_end = protocol.read_field_end().unwrap();
Required methods
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_bool(&mut self) -> Result<bool>
Read a bool.
fn read_bytes(&mut self) -> Result<Vec<u8>>
Read a fixed-length byte array.
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.
This method should never be used in generated code.
Provided methods
fn skip(&mut self, field_type: TType) -> Result<()>
Skip a field with type field_type
recursively until the default
maximum skip depth is reached.
fn skip_till_depth(&mut self, field_type: TType, depth: i8) -> Result<()>
Skip a field with type field_type
recursively up to depth
levels.
Implementations on Foreign Types
impl<P: ?Sized> TInputProtocol for Box<P> where
P: TInputProtocol,
[src]
P: TInputProtocol,
fn read_message_begin(&mut self) -> Result<TMessageIdentifier>
[src]
fn read_message_end(&mut self) -> Result<()>
[src]
fn read_struct_begin(&mut self) -> Result<Option<TStructIdentifier>>
[src]
fn read_struct_end(&mut self) -> Result<()>
[src]
fn read_field_begin(&mut self) -> Result<TFieldIdentifier>
[src]
fn read_field_end(&mut self) -> Result<()>
[src]
fn read_bool(&mut self) -> Result<bool>
[src]
fn read_bytes(&mut self) -> Result<Vec<u8>>
[src]
fn read_i8(&mut self) -> Result<i8>
[src]
fn read_i16(&mut self) -> Result<i16>
[src]
fn read_i32(&mut self) -> Result<i32>
[src]
fn read_i64(&mut self) -> Result<i64>
[src]
fn read_double(&mut self) -> Result<f64>
[src]
fn read_string(&mut self) -> Result<String>
[src]
fn read_list_begin(&mut self) -> Result<TListIdentifier>
[src]
fn read_list_end(&mut self) -> Result<()>
[src]
fn read_set_begin(&mut self) -> Result<TSetIdentifier>
[src]
fn read_set_end(&mut self) -> Result<()>
[src]
fn read_map_begin(&mut self) -> Result<TMapIdentifier>
[src]
fn read_map_end(&mut self) -> Result<()>
[src]
fn read_byte(&mut self) -> Result<u8>
[src]
Implementors
impl<'a> TInputProtocol for TStoredInputProtocol<'a>
[src]
fn read_message_begin(&mut self) -> Result<TMessageIdentifier>
[src]
fn read_message_end(&mut self) -> Result<()>
[src]
fn read_struct_begin(&mut self) -> Result<Option<TStructIdentifier>>
[src]
fn read_struct_end(&mut self) -> Result<()>
[src]
fn read_field_begin(&mut self) -> Result<TFieldIdentifier>
[src]
fn read_field_end(&mut self) -> Result<()>
[src]
fn read_bytes(&mut self) -> Result<Vec<u8>>
[src]
fn read_bool(&mut self) -> Result<bool>
[src]
fn read_i8(&mut self) -> Result<i8>
[src]
fn read_i16(&mut self) -> Result<i16>
[src]
fn read_i32(&mut self) -> Result<i32>
[src]
fn read_i64(&mut self) -> Result<i64>
[src]
fn read_double(&mut self) -> Result<f64>
[src]
fn read_string(&mut self) -> Result<String>
[src]
fn read_list_begin(&mut self) -> Result<TListIdentifier>
[src]
fn read_list_end(&mut self) -> Result<()>
[src]
fn read_set_begin(&mut self) -> Result<TSetIdentifier>
[src]
fn read_set_end(&mut self) -> Result<()>
[src]
fn read_map_begin(&mut self) -> Result<TMapIdentifier>
[src]
fn read_map_end(&mut self) -> Result<()>
[src]
fn read_byte(&mut self) -> Result<u8>
[src]
impl<T> TInputProtocol for TBinaryInputProtocol<T> where
T: TReadTransport,
[src]
T: TReadTransport,
fn read_message_begin(&mut self) -> Result<TMessageIdentifier>
[src]
fn read_message_end(&mut self) -> Result<()>
[src]
fn read_struct_begin(&mut self) -> Result<Option<TStructIdentifier>>
[src]
fn read_struct_end(&mut self) -> Result<()>
[src]
fn read_field_begin(&mut self) -> Result<TFieldIdentifier>
[src]
fn read_field_end(&mut self) -> Result<()>
[src]
fn read_bytes(&mut self) -> Result<Vec<u8>>
[src]
fn read_bool(&mut self) -> Result<bool>
[src]
fn read_i8(&mut self) -> Result<i8>
[src]
fn read_i16(&mut self) -> Result<i16>
[src]
fn read_i32(&mut self) -> Result<i32>
[src]
fn read_i64(&mut self) -> Result<i64>
[src]
fn read_double(&mut self) -> Result<f64>
[src]
fn read_string(&mut self) -> Result<String>
[src]
fn read_list_begin(&mut self) -> Result<TListIdentifier>
[src]
fn read_list_end(&mut self) -> Result<()>
[src]
fn read_set_begin(&mut self) -> Result<TSetIdentifier>
[src]
fn read_set_end(&mut self) -> Result<()>
[src]
fn read_map_begin(&mut self) -> Result<TMapIdentifier>
[src]
fn read_map_end(&mut self) -> Result<()>
[src]
fn read_byte(&mut self) -> Result<u8>
[src]
impl<T> TInputProtocol for TCompactInputProtocol<T> where
T: TReadTransport,
[src]
T: TReadTransport,