ThriftSliceInputProtocol

Struct ThriftSliceInputProtocol 

Source
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§

Source§

impl<'a> ThriftSliceInputProtocol<'a>

Source

pub fn new(buf: &'a [u8]) -> Self

Create a new ThriftSliceInputProtocol using the bytes in buf.

Source

pub fn as_slice(&self) -> &'a [u8]

Return the current buffer as a slice.

Trait Implementations§

Source§

impl<'b, 'a: 'b> ThriftCompactInputProtocol<'b> for ThriftSliceInputProtocol<'a>

Source§

fn read_byte(&mut self) -> Result<u8>

Read a single byte from the input.
Source§

fn read_bytes(&mut self) -> Result<&'b [u8]>

Read a Thrift encoded binary from the input.
Source§

fn read_bytes_owned(&mut self) -> Result<Vec<u8>>

Source§

fn skip_bytes(&mut self, n: usize) -> Result<()>

Skip the next n bytes of input.
Source§

fn read_double(&mut self) -> Result<f64>

Read a Thrift double as f64.
Source§

fn read_vlq(&mut self) -> Result<u64>

Read a ULEB128 encoded unsigned varint from the input.
Source§

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>

Read the ListIdentifier for a Thrift encoded list.
Source§

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)>

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 more
Source§

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 read_string(&mut self) -> Result<&'a str>

Read a Thrift binary as a UTF-8 encoded string.
Source§

fn read_i8(&mut self) -> Result<i8>

Read an i8.
Source§

fn read_i16(&mut self) -> Result<i16>

Read an i16.
Source§

fn read_i32(&mut self) -> Result<i32>

Read an i32.
Source§

fn read_i64(&mut self) -> Result<i64>

Read an i64.
Source§

fn skip_vlq(&mut self) -> Result<()>

Skip a ULEB128 encoded varint.
Source§

fn skip_binary(&mut self) -> Result<()>

Skip a thrift binary.
Source§

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<()>

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<()>

Skip a field with type field_type recursively up to depth levels.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> Ungil for T
where T: Send,