pub(crate) trait ThriftCompactInputProtocol<'a> {
Show 22 methods
// Required methods
fn read_byte(&mut self) -> Result<u8, ThriftProtocolError>;
fn read_bytes(&mut self) -> Result<&'a [u8], ThriftProtocolError>;
fn read_bytes_owned(&mut self) -> Result<Vec<u8>, ThriftProtocolError>;
fn skip_bytes(&mut self, n: usize) -> Result<(), ThriftProtocolError>;
fn read_double(&mut self) -> Result<f64, ThriftProtocolError>;
// Provided methods
fn read_vlq(&mut self) -> Result<u64, ThriftProtocolError> { ... }
fn read_zig_zag(&mut self) -> Result<i64, ThriftProtocolError> { ... }
fn read_list_begin(&mut self) -> Result<ListIdentifier, ThriftProtocolError> { ... }
fn read_full_field_id(&mut self) -> Result<i16, ThriftProtocolError> { ... }
fn read_field_begin(
&mut self,
last_field_id: i16,
) -> Result<FieldIdentifier, ThriftProtocolError> { ... }
fn read_field_header(&mut self) -> Result<(u8, u8), ThriftProtocolError> { ... }
fn read_bool(&mut self) -> Result<bool, ThriftProtocolError> { ... }
fn read_string(&mut self) -> Result<&'a str, ThriftProtocolError> { ... }
fn read_i8(&mut self) -> Result<i8, ThriftProtocolError> { ... }
fn read_i16(&mut self) -> Result<i16, ThriftProtocolError> { ... }
fn read_i32(&mut self) -> Result<i32, ThriftProtocolError> { ... }
fn read_i64(&mut self) -> Result<i64, ThriftProtocolError> { ... }
fn skip_vlq(&mut self) -> Result<(), ThriftProtocolError> { ... }
fn skip_binary(&mut self) -> Result<(), ThriftProtocolError> { ... }
fn skip(&mut self, field_type: FieldType) -> Result<(), ThriftProtocolError> { ... }
fn skip_empty_struct(&mut self) -> Result<()> { ... }
fn skip_till_depth(
&mut self,
field_type: FieldType,
depth: i8,
) -> Result<(), ThriftProtocolError> { ... }
}Expand description
Low-level object used to deserialize structs encoded with the Thrift compact protocol.
Implementation of this trait must provide the low-level functions read_byte, read_bytes,
skip_bytes, and read_double. These primitives are used by the default functions provided
here to perform deserialization.
Required Methods§
Sourcefn read_byte(&mut self) -> Result<u8, ThriftProtocolError>
fn read_byte(&mut self) -> Result<u8, ThriftProtocolError>
Read a single byte from the input.
Sourcefn read_bytes(&mut self) -> Result<&'a [u8], ThriftProtocolError>
fn read_bytes(&mut self) -> Result<&'a [u8], ThriftProtocolError>
Read a Thrift encoded binary from the input.
fn read_bytes_owned(&mut self) -> Result<Vec<u8>, ThriftProtocolError>
Sourcefn skip_bytes(&mut self, n: usize) -> Result<(), ThriftProtocolError>
fn skip_bytes(&mut self, n: usize) -> Result<(), ThriftProtocolError>
Skip the next n bytes of input.
Sourcefn read_double(&mut self) -> Result<f64, ThriftProtocolError>
fn read_double(&mut self) -> Result<f64, ThriftProtocolError>
Read a Thrift double as f64.
Provided Methods§
Sourcefn read_vlq(&mut self) -> Result<u64, ThriftProtocolError>
fn read_vlq(&mut self) -> Result<u64, ThriftProtocolError>
Read a ULEB128 encoded unsigned varint from the input.
Sourcefn read_zig_zag(&mut self) -> Result<i64, ThriftProtocolError>
fn read_zig_zag(&mut self) -> Result<i64, ThriftProtocolError>
Read a zig-zag encoded signed varint from the input.
Sourcefn read_list_begin(&mut self) -> Result<ListIdentifier, ThriftProtocolError>
fn read_list_begin(&mut self) -> Result<ListIdentifier, ThriftProtocolError>
Read the ListIdentifier for a Thrift encoded list.
fn read_full_field_id(&mut self) -> Result<i16, ThriftProtocolError>
Sourcefn read_field_begin(
&mut self,
last_field_id: i16,
) -> Result<FieldIdentifier, ThriftProtocolError>
fn read_field_begin( &mut self, last_field_id: i16, ) -> Result<FieldIdentifier, ThriftProtocolError>
Read the FieldIdentifier for a field in a Thrift encoded struct.
Sourcefn read_field_header(&mut self) -> Result<(u8, u8), ThriftProtocolError>
fn read_field_header(&mut self) -> Result<(u8, u8), ThriftProtocolError>
This is a specialized version of Self::read_field_begin, solely for use in parsing
simple structs. This function assumes that the delta field will always be less than 0xf,
fields will be in order, and no boolean fields will be read.
This also skips validation of the field type.
Returns a tuple of (field_type, field_delta).
Sourcefn read_bool(&mut self) -> Result<bool, ThriftProtocolError>
fn read_bool(&mut self) -> Result<bool, ThriftProtocolError>
Read a boolean list element. This should not be used for struct fields. For the latter,
use the FieldIdentifier::bool_val field.
Sourcefn read_string(&mut self) -> Result<&'a str, ThriftProtocolError>
fn read_string(&mut self) -> Result<&'a str, ThriftProtocolError>
Read a Thrift binary as a UTF-8 encoded string.
Sourcefn read_i8(&mut self) -> Result<i8, ThriftProtocolError>
fn read_i8(&mut self) -> Result<i8, ThriftProtocolError>
Read an i8.
Sourcefn read_i16(&mut self) -> Result<i16, ThriftProtocolError>
fn read_i16(&mut self) -> Result<i16, ThriftProtocolError>
Read an i16.
Sourcefn read_i32(&mut self) -> Result<i32, ThriftProtocolError>
fn read_i32(&mut self) -> Result<i32, ThriftProtocolError>
Read an i32.
Sourcefn read_i64(&mut self) -> Result<i64, ThriftProtocolError>
fn read_i64(&mut self) -> Result<i64, ThriftProtocolError>
Read an i64.
Sourcefn skip_vlq(&mut self) -> Result<(), ThriftProtocolError>
fn skip_vlq(&mut self) -> Result<(), ThriftProtocolError>
Skip a ULEB128 encoded varint.
Sourcefn skip_binary(&mut self) -> Result<(), ThriftProtocolError>
fn skip_binary(&mut self) -> Result<(), ThriftProtocolError>
Skip a thrift binary.
Sourcefn skip(&mut self, field_type: FieldType) -> Result<(), ThriftProtocolError>
fn skip(&mut self, field_type: FieldType) -> Result<(), ThriftProtocolError>
Skip a field with type field_type recursively until the default
maximum skip depth (currently 64) is reached.
Sourcefn skip_empty_struct(&mut self) -> Result<()>
fn skip_empty_struct(&mut self) -> Result<()>
Empty structs in unions consist of a single byte of 0 for the field stop record.
This skips that byte without encuring the cost of processing the FieldIdentifier.
Will return an error if the struct is not actually empty.
Sourcefn skip_till_depth(
&mut self,
field_type: FieldType,
depth: i8,
) -> Result<(), ThriftProtocolError>
fn skip_till_depth( &mut self, field_type: FieldType, depth: i8, ) -> Result<(), ThriftProtocolError>
Skip a field with type field_type recursively up to depth levels.