pub trait CompactThriftProtocol<'i> {
const FIELD_TYPE: u8;
// Required methods
fn fill_thrift<T: CompactThriftInput<'i>>(
&mut self,
input: &mut T,
) -> Result<(), ThriftError>;
fn write_thrift<T: CompactThriftOutput>(
&self,
output: &mut T,
) -> Result<(), ThriftError>;
// Provided methods
fn read_thrift<T: CompactThriftInput<'i>>(
input: &mut T,
) -> Result<Self, ThriftError>
where Self: Default { ... }
fn fill_thrift_field<T: CompactThriftInput<'i>>(
&mut self,
input: &mut T,
field_type: u8,
) -> Result<(), ThriftError> { ... }
fn write_thrift_field<T: CompactThriftOutput>(
&self,
output: &mut T,
field_id: i16,
last_field_id: &mut i16,
) -> Result<(), ThriftError> { ... }
}Required Associated Constants§
const FIELD_TYPE: u8
Required Methods§
fn fill_thrift<T: CompactThriftInput<'i>>( &mut self, input: &mut T, ) -> Result<(), ThriftError>
fn write_thrift<T: CompactThriftOutput>( &self, output: &mut T, ) -> Result<(), ThriftError>
Provided Methods§
fn read_thrift<T: CompactThriftInput<'i>>(
input: &mut T,
) -> Result<Self, ThriftError>where
Self: Default,
fn fill_thrift_field<T: CompactThriftInput<'i>>( &mut self, input: &mut T, field_type: u8, ) -> Result<(), ThriftError>
fn write_thrift_field<T: CompactThriftOutput>( &self, output: &mut T, field_id: i16, last_field_id: &mut i16, ) -> Result<(), ThriftError>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl<'i> CompactThriftProtocol<'i> for Cow<'i, str>
impl<'i> CompactThriftProtocol<'i> for Cow<'i, str>
const FIELD_TYPE: u8 = 8u8
fn fill_thrift<T: CompactThriftInput<'i>>( &mut self, input: &mut T, ) -> Result<(), ThriftError>
fn write_thrift<T: CompactThriftOutput>( &self, output: &mut T, ) -> Result<(), ThriftError>
Source§impl<'i> CompactThriftProtocol<'i> for Cow<'i, [u8]>
impl<'i> CompactThriftProtocol<'i> for Cow<'i, [u8]>
const FIELD_TYPE: u8 = 8u8
fn fill_thrift<T: CompactThriftInput<'i>>( &mut self, input: &mut T, ) -> Result<(), ThriftError>
fn write_thrift<T: CompactThriftOutput>( &self, output: &mut T, ) -> Result<(), ThriftError>
Source§impl<'i> CompactThriftProtocol<'i> for bool
For structs, the following field-types can be encoded:
impl<'i> CompactThriftProtocol<'i> for bool
For structs, the following field-types can be encoded:
- BOOLEAN_TRUE, encoded as 1
- BOOLEAN_FALSE, encoded as 2
For lists and sets the following element-types are used (see note 1 below):
- BOOL, encoded as 1 or 2 (see note below)
The only valid value in the original spec was 2, but due to an widespread implementation bug the defacto standard across large parts of the library became 1 instead. As a result, both values are now allowed.
Element values of type bool are sent as an int8; true as 1 and false as 2.
Previous versions of the spec said true is 1 and false is 0, so we are a bit more lenient and support both when reading.