pub(crate) struct ThriftSliceInputProtocol<'a> {
buf: &'a [u8],
}Expand description
A high performance Thrift reader that reads from a slice of bytes.
Fields§
§buf: &'a [u8]Implementations§
Trait Implementations§
Source§impl<'b, 'a: 'b> ThriftCompactInputProtocol<'b> for ThriftSliceInputProtocol<'a>
impl<'b, 'a: 'b> ThriftCompactInputProtocol<'b> for ThriftSliceInputProtocol<'a>
Source§fn read_bytes(&mut self) -> Result<&'b [u8], ThriftProtocolError>
fn read_bytes(&mut self) -> Result<&'b [u8], ThriftProtocolError>
Read a Thrift encoded binary from the input.
fn read_bytes_owned(&mut self) -> Result<Vec<u8>, ThriftProtocolError>
Source§fn skip_bytes(&mut self, n: usize) -> Result<(), ThriftProtocolError>
fn skip_bytes(&mut self, n: usize) -> Result<(), ThriftProtocolError>
Skip the next
n bytes of input.Source§fn read_double(&mut self) -> Result<f64, ThriftProtocolError>
fn read_double(&mut self) -> Result<f64, ThriftProtocolError>
Read a Thrift
double as f64.Source§fn read_vlq(&mut self) -> Result<u64, ThriftProtocolError>
fn read_vlq(&mut self) -> Result<u64, ThriftProtocolError>
Read a ULEB128 encoded unsigned varint from the input.
Source§fn 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.
Source§fn 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>
Source§fn 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.Source§fn 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. Read moreSource§fn 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.Source§fn 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.
Source§fn skip_binary(&mut self) -> Result<(), ThriftProtocolError>
fn skip_binary(&mut self) -> Result<(), ThriftProtocolError>
Skip a thrift binary.
Source§fn 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.Source§fn 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.Source§fn 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.Auto Trait Implementations§
impl<'a> Freeze for ThriftSliceInputProtocol<'a>
impl<'a> RefUnwindSafe for ThriftSliceInputProtocol<'a>
impl<'a> Send for ThriftSliceInputProtocol<'a>
impl<'a> Sync for ThriftSliceInputProtocol<'a>
impl<'a> Unpin for ThriftSliceInputProtocol<'a>
impl<'a> UnwindSafe for ThriftSliceInputProtocol<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more