Skip to main content

TBinaryProtocol

Struct TBinaryProtocol 

Source
pub struct TBinaryProtocol<T> { /* private fields */ }

Implementations§

Source§

impl<T> TBinaryProtocol<T>

Source

pub fn new(trans: T, zero_copy: bool) -> Self

zero_copy only takes effect when T is BytesMut for input and LinkedBytes for output.

Trait Implementations§

Source§

impl TInputProtocol for TBinaryProtocol<&mut Bytes>

Source§

type Buf = Bytes

Source§

fn read_message_begin(&mut self) -> Result<TMessageIdentifier, ThriftException>

Read the beginning of a Thrift message.
Source§

fn read_message_end(&mut self) -> Result<(), ThriftException>

Read the end of a Thrift message.
Source§

fn read_struct_begin( &mut self, ) -> Result<Option<TStructIdentifier>, ThriftException>

Read the beginning of a Thrift struct.
Source§

fn read_struct_end(&mut self) -> Result<(), ThriftException>

Read the end of a Thrift struct.
Source§

fn read_field_begin(&mut self) -> Result<TFieldIdentifier, ThriftException>

Read the beginning of a Thrift struct field.
Source§

fn read_field_end(&mut self) -> Result<(), ThriftException>

Read the end of a Thrift struct field.
Source§

fn read_bool(&mut self) -> Result<bool, ThriftException>

Read a bool.
Source§

fn read_bytes(&mut self) -> Result<Bytes, ThriftException>

Read a binary.
Source§

fn get_bytes( &mut self, ptr: Option<*const u8>, len: usize, ) -> Result<Bytes, ThriftException>

Source§

fn read_uuid(&mut self) -> Result<[u8; 16], ThriftException>

Read a uuid.
Source§

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

Read a word.
Source§

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

Read a 16-bit signed integer.
Source§

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

Read a 32-bit signed integer.
Source§

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

Read a 64-bit signed integer.
Source§

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

Read a 64-bit float.
Source§

fn read_string(&mut self) -> Result<String, ThriftException>

Read a fixed-length string (not null terminated).
Source§

fn read_faststr(&mut self) -> Result<FastStr, ThriftException>

Read a faststr.
Source§

fn read_list_begin(&mut self) -> Result<TListIdentifier, ThriftException>

Read the beginning of a list.
Source§

fn read_list_end(&mut self) -> Result<(), ThriftException>

Read the end of a list.
Source§

fn read_set_begin(&mut self) -> Result<TSetIdentifier, ThriftException>

Read the beginning of a set.
Source§

fn read_set_end(&mut self) -> Result<(), ThriftException>

Read the end of a set.
Source§

fn read_map_begin(&mut self) -> Result<TMapIdentifier, ThriftException>

Read the beginning of a map.
Source§

fn read_map_end(&mut self) -> Result<(), ThriftException>

Read the end of a map.
Source§

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

Read an unsigned byte. Read more
Source§

fn read_bytes_vec(&mut self) -> Result<Vec<u8>, ThriftException>

Read a Vec.
Source§

fn skip(&mut self, field_type: TType) -> Result<usize, ThriftException>

Skip a field with type field_type recursively until the default maximum skip depth is reached.
Source§

fn skip_till_depth( &mut self, field_type: TType, depth: i8, ) -> Result<usize, ThriftException>

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

impl<T> TLengthProtocol for TBinaryProtocol<T>

Source§

fn message_begin_len(&mut self, identifier: &TMessageIdentifier) -> usize

Source§

fn message_end_len(&mut self) -> usize

Source§

fn struct_begin_len(&mut self, _identifier: &TStructIdentifier) -> usize

Source§

fn struct_end_len(&mut self) -> usize

Source§

fn field_begin_len(&mut self, _field_type: TType, _id: Option<i16>) -> usize

Source§

fn field_end_len(&mut self) -> usize

Source§

fn field_stop_len(&mut self) -> usize

Source§

fn bool_len(&mut self, _b: bool) -> usize

Source§

fn bytes_len(&mut self, b: &[u8]) -> usize

Source§

fn byte_len(&mut self, _b: u8) -> usize

Source§

fn uuid_len(&mut self, _u: [u8; 16]) -> usize

Source§

fn i8_len(&mut self, _i: i8) -> usize

Source§

fn i16_len(&mut self, _i: i16) -> usize

Source§

fn i32_len(&mut self, _i: i32) -> usize

Source§

fn i64_len(&mut self, _i: i64) -> usize

Source§

fn double_len(&mut self, _d: f64) -> usize

Source§

fn string_len(&mut self, s: &str) -> usize

Source§

fn faststr_len(&mut self, s: &FastStr) -> usize

Source§

fn list_begin_len(&mut self, _identifier: TListIdentifier) -> usize

Source§

fn list_end_len(&mut self) -> usize

Source§

fn set_begin_len(&mut self, _identifier: TSetIdentifier) -> usize

Source§

fn set_end_len(&mut self) -> usize

Source§

fn map_begin_len(&mut self, _identifier: TMapIdentifier) -> usize

Source§

fn map_end_len(&mut self) -> usize

Source§

fn bytes_vec_len(&mut self, b: &[u8]) -> usize

Source§

fn zero_copy_len(&mut self) -> usize

The zero copy length used to calculate the recommended malloc length.
Source§

fn reset(&mut self)

Resets the zero copy length counter.
Source§

impl TOutputProtocol for TBinaryProtocol<&mut BytesMut>

Source§

type BufMut = BytesMut

Source§

fn write_message_begin( &mut self, identifier: &TMessageIdentifier, ) -> Result<(), ThriftException>

Write the beginning of a Thrift message.
Source§

fn write_message_end(&mut self) -> Result<(), ThriftException>

Write the end of a Thrift message.
Source§

fn write_struct_begin( &mut self, _: &TStructIdentifier, ) -> Result<(), ThriftException>

Write the beginning of a Thrift struct.
Source§

fn write_struct_end(&mut self) -> Result<(), ThriftException>

Write the end of a Thrift struct.
Source§

fn write_field_begin( &mut self, field_type: TType, id: i16, ) -> Result<(), ThriftException>

Write the beginning of a Thrift field.
Source§

fn write_field_end(&mut self) -> Result<(), ThriftException>

Write the end of a Thrift field.
Source§

fn write_field_stop(&mut self) -> Result<(), ThriftException>

Write a STOP field indicating that all the fields in a struct have been written.
Source§

fn write_bool(&mut self, b: bool) -> Result<(), ThriftException>

Write a bool.
Source§

fn write_bytes(&mut self, b: Bytes) -> Result<(), ThriftException>

Write a fixed-length byte array.
Source§

fn write_bytes_without_len(&mut self, b: Bytes) -> Result<(), ThriftException>

Source§

fn write_byte(&mut self, b: u8) -> Result<(), ThriftException>

Write a byte.
Source§

fn write_uuid(&mut self, u: [u8; 16]) -> Result<(), ThriftException>

Write a uuid.
Source§

fn write_i8(&mut self, i: i8) -> Result<(), ThriftException>

Write an 8-bit signed integer.
Source§

fn write_i16(&mut self, i: i16) -> Result<(), ThriftException>

Write a 16-bit signed integer.
Source§

fn write_i32(&mut self, i: i32) -> Result<(), ThriftException>

Write a 32-bit signed integer.
Source§

fn write_i64(&mut self, i: i64) -> Result<(), ThriftException>

Write a 64-bit signed integer.
Source§

fn write_double(&mut self, d: f64) -> Result<(), ThriftException>

Write a 64-bit float.
Source§

fn write_string(&mut self, s: &str) -> Result<(), ThriftException>

Write a fixed-length string.
Source§

fn write_faststr(&mut self, s: FastStr) -> Result<(), ThriftException>

Write a fixed-length faststr.
Source§

fn write_list_begin( &mut self, identifier: TListIdentifier, ) -> Result<(), ThriftException>

Write the beginning of a list.
Source§

fn write_list_end(&mut self) -> Result<(), ThriftException>

Write the end of a list.
Source§

fn write_set_begin( &mut self, identifier: TSetIdentifier, ) -> Result<(), ThriftException>

Write the beginning of a set.
Source§

fn write_set_end(&mut self) -> Result<(), ThriftException>

Write the end of a set.
Source§

fn write_map_begin( &mut self, identifier: TMapIdentifier, ) -> Result<(), ThriftException>

Write the beginning of a map.
Source§

fn write_map_end(&mut self) -> Result<(), ThriftException>

Write the end of a map.
Source§

fn flush(&mut self) -> Result<(), ThriftException>

Flush buffered bytes to the underlying transport.
Source§

fn write_bytes_vec(&mut self, b: &[u8]) -> Result<(), ThriftException>

Write a Vec.
Source§

impl TOutputProtocol for TBinaryProtocol<&mut LinkedBytes>

Source§

type BufMut = LinkedBytes

Source§

fn write_message_begin( &mut self, identifier: &TMessageIdentifier, ) -> Result<(), ThriftException>

Write the beginning of a Thrift message.
Source§

fn write_message_end(&mut self) -> Result<(), ThriftException>

Write the end of a Thrift message.
Source§

fn write_struct_begin( &mut self, _: &TStructIdentifier, ) -> Result<(), ThriftException>

Write the beginning of a Thrift struct.
Source§

fn write_struct_end(&mut self) -> Result<(), ThriftException>

Write the end of a Thrift struct.
Source§

fn write_field_begin( &mut self, field_type: TType, id: i16, ) -> Result<(), ThriftException>

Write the beginning of a Thrift field.
Source§

fn write_field_end(&mut self) -> Result<(), ThriftException>

Write the end of a Thrift field.
Source§

fn write_field_stop(&mut self) -> Result<(), ThriftException>

Write a STOP field indicating that all the fields in a struct have been written.
Source§

fn write_bool(&mut self, b: bool) -> Result<(), ThriftException>

Write a bool.
Source§

fn write_bytes(&mut self, b: Bytes) -> Result<(), ThriftException>

Write a fixed-length byte array.
Source§

fn write_bytes_without_len(&mut self, b: Bytes) -> Result<(), ThriftException>

Source§

fn write_byte(&mut self, b: u8) -> Result<(), ThriftException>

Write a byte.
Source§

fn write_uuid(&mut self, u: [u8; 16]) -> Result<(), ThriftException>

Write a uuid.
Source§

fn write_i8(&mut self, i: i8) -> Result<(), ThriftException>

Write an 8-bit signed integer.
Source§

fn write_i16(&mut self, i: i16) -> Result<(), ThriftException>

Write a 16-bit signed integer.
Source§

fn write_i32(&mut self, i: i32) -> Result<(), ThriftException>

Write a 32-bit signed integer.
Source§

fn write_i64(&mut self, i: i64) -> Result<(), ThriftException>

Write a 64-bit signed integer.
Source§

fn write_double(&mut self, d: f64) -> Result<(), ThriftException>

Write a 64-bit float.
Source§

fn write_string(&mut self, s: &str) -> Result<(), ThriftException>

Write a fixed-length string.
Source§

fn write_faststr(&mut self, s: FastStr) -> Result<(), ThriftException>

Write a fixed-length faststr.
Source§

fn write_list_begin( &mut self, identifier: TListIdentifier, ) -> Result<(), ThriftException>

Write the beginning of a list.
Source§

fn write_list_end(&mut self) -> Result<(), ThriftException>

Write the end of a list.
Source§

fn write_set_begin( &mut self, identifier: TSetIdentifier, ) -> Result<(), ThriftException>

Write the beginning of a set.
Source§

fn write_set_end(&mut self) -> Result<(), ThriftException>

Write the end of a set.
Source§

fn write_map_begin( &mut self, identifier: TMapIdentifier, ) -> Result<(), ThriftException>

Write the beginning of a map.
Source§

fn write_map_end(&mut self) -> Result<(), ThriftException>

Write the end of a map.
Source§

fn flush(&mut self) -> Result<(), ThriftException>

Flush buffered bytes to the underlying transport.
Source§

fn write_bytes_vec(&mut self, b: &[u8]) -> Result<(), ThriftException>

Write a Vec.

Auto Trait Implementations§

§

impl<T> Freeze for TBinaryProtocol<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for TBinaryProtocol<T>
where T: RefUnwindSafe,

§

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

§

impl<T> Sync for TBinaryProtocol<T>
where T: Sync,

§

impl<T> Unpin for TBinaryProtocol<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for TBinaryProtocol<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for TBinaryProtocol<T>
where T: UnwindSafe,

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> TLengthProtocolExt for T
where T: TLengthProtocol,

Source§

fn bool_field_len(&mut self, id: Option<i16>, b: bool) -> usize

Source§

fn i8_field_len(&mut self, id: Option<i16>, i: i8) -> usize

Source§

fn i16_field_len(&mut self, id: Option<i16>, i: i16) -> usize

Source§

fn i32_field_len(&mut self, id: Option<i16>, i: i32) -> usize

Source§

fn i64_field_len(&mut self, id: Option<i16>, i: i64) -> usize

Source§

fn double_field_len(&mut self, id: Option<i16>, d: f64) -> usize

Source§

fn bytes_field_len(&mut self, id: Option<i16>, b: &[u8]) -> usize

Source§

fn bytes_vec_field_len(&mut self, id: Option<i16>, b: &[u8]) -> usize

Source§

fn uuid_field_len(&mut self, id: Option<i16>, u: [u8; 16]) -> usize

Source§

fn string_field_len(&mut self, id: Option<i16>, s: &str) -> usize

Source§

fn faststr_field_len(&mut self, id: Option<i16>, s: &FastStr) -> usize

Source§

fn byte_field_len(&mut self, id: Option<i16>, b: u8) -> usize

Source§

fn void_field_len(&mut self, id: Option<i16>) -> usize

Source§

fn list_field_len<T, F>( &mut self, id: Option<i16>, el_ttype: TType, els: &[T], el_len: F, ) -> usize
where F: Fn(&mut Self, &T) -> usize,

Source§

fn list_len<T, F>(&mut self, el_ttype: TType, els: &[T], len: F) -> usize
where F: Fn(&mut Self, &T) -> usize,

Source§

fn set_field_len<T, F>( &mut self, id: Option<i16>, el_ttype: TType, els: &AHashSet<T>, el_len: F, ) -> usize
where F: Fn(&mut Self, &T) -> usize,

Source§

fn set_len<T, F>( &mut self, el_ttype: TType, els: &AHashSet<T>, el_len: F, ) -> usize
where F: Fn(&mut Self, &T) -> usize,

Source§

fn btree_set_field_len<T, F>( &mut self, id: Option<i16>, el_ttype: TType, els: &BTreeSet<T>, el_len: F, ) -> usize
where F: Fn(&mut Self, &T) -> usize,

Source§

fn btree_set_len<T, F>( &mut self, el_ttype: TType, els: &BTreeSet<T>, el_len: F, ) -> usize
where F: Fn(&mut Self, &T) -> usize,

Source§

fn message_len<M: Message>(&mut self, id: Option<i16>, m: &M) -> usize

Source§

fn map_field_len<K, V, FK, FV>( &mut self, id: Option<i16>, key_ttype: TType, val_ttype: TType, els: &AHashMap<K, V>, key_len: FK, val_len: FV, ) -> usize
where FK: Fn(&mut Self, &K) -> usize, FV: Fn(&mut Self, &V) -> usize,

Source§

fn map_len<K, V, FK, FV>( &mut self, key_ttype: TType, val_ttype: TType, els: &AHashMap<K, V>, key_len: FK, val_len: FV, ) -> usize
where FK: Fn(&mut Self, &K) -> usize, FV: Fn(&mut Self, &V) -> usize,

Source§

fn btree_map_field_len<K, V, FK, FV>( &mut self, id: Option<i16>, key_ttype: TType, val_ttype: TType, els: &BTreeMap<K, V>, key_len: FK, val_len: FV, ) -> usize
where FK: Fn(&mut Self, &K) -> usize, FV: Fn(&mut Self, &V) -> usize,

Source§

fn btree_map_len<K, V, FK, FV>( &mut self, key_ttype: TType, val_ttype: TType, els: &BTreeMap<K, V>, key_len: FK, val_len: FV, ) -> usize
where FK: Fn(&mut Self, &K) -> usize, FV: Fn(&mut Self, &V) -> usize,

Source§

fn void_len(&mut self) -> usize

Source§

fn struct_field_len<M: Message>(&mut self, id: Option<i16>, m: &M) -> usize

Source§

fn struct_len<M: Message>(&mut self, m: &M) -> usize

Source§

impl<T> TOutputProtocolExt for T
where T: TOutputProtocol,

Source§

fn write_bool_field(&mut self, id: i16, b: bool) -> Result<(), ThriftException>

Source§

fn write_i8_field(&mut self, id: i16, i: i8) -> Result<(), ThriftException>

Source§

fn write_i16_field(&mut self, id: i16, i: i16) -> Result<(), ThriftException>

Source§

fn write_i32_field(&mut self, id: i16, i: i32) -> Result<(), ThriftException>

Source§

fn write_i64_field(&mut self, id: i16, i: i64) -> Result<(), ThriftException>

Source§

fn write_double_field(&mut self, id: i16, d: f64) -> Result<(), ThriftException>

Source§

fn write_bytes_field( &mut self, id: i16, b: Bytes, ) -> Result<(), ThriftException>

Source§

fn write_bytes_vec_field( &mut self, id: i16, b: &[u8], ) -> Result<(), ThriftException>

Source§

fn write_uuid_field( &mut self, id: i16, u: [u8; 16], ) -> Result<(), ThriftException>

Source§

fn write_string_field( &mut self, id: i16, s: &str, ) -> Result<(), ThriftException>

Source§

fn write_faststr_field( &mut self, id: i16, s: FastStr, ) -> Result<(), ThriftException>

Source§

fn write_void_field(&mut self, id: i16) -> Result<(), ThriftException>

Source§

fn write_byte_field(&mut self, id: i16, b: u8) -> Result<(), ThriftException>

Source§

fn write_list_field<T, F>( &mut self, id: i16, el_ttype: TType, els: &[T], encode: F, ) -> Result<(), ThriftException>
where F: Fn(&mut Self, &T) -> Result<(), ThriftException>,

Source§

fn write_list<T, F>( &mut self, el_ttype: TType, els: &[T], encode: F, ) -> Result<(), ThriftException>
where F: Fn(&mut Self, &T) -> Result<(), ThriftException>,

Source§

fn write_set_field<T, F>( &mut self, id: i16, el_ttype: TType, els: &AHashSet<T>, encode: F, ) -> Result<(), ThriftException>
where F: Fn(&mut Self, &T) -> Result<(), ThriftException>,

Source§

fn write_set<T, F>( &mut self, el_ttype: TType, els: &AHashSet<T>, encode: F, ) -> Result<(), ThriftException>
where F: Fn(&mut Self, &T) -> Result<(), ThriftException>,

Source§

fn write_btree_set_field<T, F>( &mut self, id: i16, el_ttype: TType, els: &BTreeSet<T>, encode: F, ) -> Result<(), ThriftException>
where F: Fn(&mut Self, &T) -> Result<(), ThriftException>,

Source§

fn write_btree_set<T, F>( &mut self, el_ttype: TType, els: &BTreeSet<T>, encode: F, ) -> Result<(), ThriftException>
where F: Fn(&mut Self, &T) -> Result<(), ThriftException>,

Source§

fn write_struct_field<M: Message>( &mut self, id: i16, m: &M, ty: TType, ) -> Result<(), ThriftException>

Source§

fn write_struct<M: Message>(&mut self, m: &M) -> Result<(), ThriftException>

Source§

fn write_map_field<K, V, FK, FV>( &mut self, id: i16, key_ttype: TType, val_ttype: TType, els: &AHashMap<K, V>, key_encode: FK, val_encode: FV, ) -> Result<(), ThriftException>
where FK: Fn(&mut Self, &K) -> Result<(), ThriftException>, FV: Fn(&mut Self, &V) -> Result<(), ThriftException>,

Source§

fn write_map<K, V, FK, FV>( &mut self, key_ttype: TType, val_ttype: TType, els: &AHashMap<K, V>, key_encode: FK, val_encode: FV, ) -> Result<(), ThriftException>
where FK: Fn(&mut Self, &K) -> Result<(), ThriftException>, FV: Fn(&mut Self, &V) -> Result<(), ThriftException>,

Source§

fn write_btree_map_field<K, V, FK, FV>( &mut self, id: i16, key_ttype: TType, val_ttype: TType, els: &BTreeMap<K, V>, key_encode: FK, val_encode: FV, ) -> Result<(), ThriftException>
where FK: Fn(&mut Self, &K) -> Result<(), ThriftException>, FV: Fn(&mut Self, &V) -> Result<(), ThriftException>,

Source§

fn write_btree_map<K, V, FK, FV>( &mut self, key_ttype: TType, val_ttype: TType, els: &BTreeMap<K, V>, key_encode: FK, val_encode: FV, ) -> Result<(), ThriftException>
where FK: Fn(&mut Self, &K) -> Result<(), ThriftException>, FV: Fn(&mut Self, &V) -> Result<(), ThriftException>,

Source§

fn write_void(&mut self) -> Result<(), ThriftException>

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.