thrift::protocol

Struct TBinaryOutputProtocol

Source
pub struct TBinaryOutputProtocol<T>
where T: TWriteTransport,
{ pub transport: T, /* private fields */ }
Expand description

Write messages using the Thrift simple binary encoding.

There are two available modes: strict and non-strict, where the strict version writes the protocol version number in the outgoing message header and the non-strict version does not.

§Examples

Create and use a TBinaryOutputProtocol.

use thrift::protocol::{TBinaryOutputProtocol, TOutputProtocol};
use thrift::transport::TTcpChannel;

let mut channel = TTcpChannel::new();
channel.open("localhost:9090").unwrap();

let mut protocol = TBinaryOutputProtocol::new(channel, true);

protocol.write_bool(true).unwrap();
protocol.write_string("test_string").unwrap();

Fields§

§transport: T

Implementations§

Source§

impl<T> TBinaryOutputProtocol<T>
where T: TWriteTransport,

Source

pub fn new(transport: T, strict: bool) -> TBinaryOutputProtocol<T>

Create a TBinaryOutputProtocol that writes bytes to transport.

Set strict to true if all outgoing messages should contain the protocol version number in the protocol header.

Trait Implementations§

Source§

impl<T> Debug for TBinaryOutputProtocol<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> TOutputProtocol for TBinaryOutputProtocol<T>
where T: TWriteTransport,

Source§

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

Write the beginning of a Thrift message.
Source§

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

Write the end of a Thrift message.
Source§

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

Write the beginning of a Thrift struct.
Source§

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

Write the end of a Thrift struct.
Source§

fn write_field_begin(&mut self, identifier: &TFieldIdentifier) -> Result<()>

Write the beginning of a Thrift field.
Source§

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

Write the end of a Thrift field.
Source§

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

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

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

Write a fixed-length byte array.
Source§

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

Write a bool.
Source§

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

Write an 8-bit signed integer.
Source§

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

Write a 16-bit signed integer.
Source§

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

Write a 32-bit signed integer.
Source§

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

Write a 64-bit signed integer.
Source§

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

Write a 64-bit float.
Source§

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

Write a fixed-length string.
Source§

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

Write the beginning of a list.
Source§

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

Write the end of a list.
Source§

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

Write the beginning of a set.
Source§

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

Write the end of a set.
Source§

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

Write the beginning of a map.
Source§

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

Write the end of a map.
Source§

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

Flush buffered bytes to the underlying transport.
Source§

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

Write an unsigned byte. Read more

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<T> UnwindSafe for TBinaryOutputProtocol<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, 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.