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>
fn read_bytes_owned(&mut self) -> Result<Vec<u8>>
Source§fn read_double(&mut self) -> Result<f64>
fn read_double(&mut self) -> Result<f64>
Read a Thrift
double
as f64
.Source§fn read_zig_zag(&mut self) -> Result<i64>
fn read_zig_zag(&mut self) -> Result<i64>
Read a zig-zag encoded signed varint from the input.
Source§fn read_list_begin(&mut self) -> Result<ListIdentifier>
fn read_list_begin(&mut self) -> Result<ListIdentifier>
Read the
ListIdentifier
for a Thrift encoded list.Source§fn read_field_begin(&mut self, last_field_id: i16) -> Result<FieldIdentifier>
fn read_field_begin(&mut self, last_field_id: i16) -> Result<FieldIdentifier>
Read the
FieldIdentifier
for a field in a Thrift encoded struct.Source§fn read_field_header(&mut self) -> Result<(u8, u8)>
fn read_field_header(&mut self) -> Result<(u8, u8)>
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>
fn read_bool(&mut self) -> Result<bool>
Read a boolean list element. This should not be used for struct fields. For the latter,
use the
FieldIdentifier::bool_val
field.Source§fn skip(&mut self, field_type: FieldType) -> Result<()>
fn skip(&mut self, field_type: FieldType) -> Result<()>
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.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