Struct thrift::protocol::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,
impl<T> TBinaryOutputProtocol<T>where
T: TWriteTransport,
sourcepub fn new(transport: T, strict: bool) -> TBinaryOutputProtocol<T>
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>where
T: TWriteTransport + Debug,
impl<T> Debug for TBinaryOutputProtocol<T>where
T: TWriteTransport + Debug,
source§impl<T> TOutputProtocol for TBinaryOutputProtocol<T>where
T: TWriteTransport,
impl<T> TOutputProtocol for TBinaryOutputProtocol<T>where
T: TWriteTransport,
source§fn write_message_begin(&mut self, identifier: &TMessageIdentifier) -> Result<()>
fn write_message_begin(&mut self, identifier: &TMessageIdentifier) -> Result<()>
Write the beginning of a Thrift message.
source§fn write_message_end(&mut self) -> Result<()>
fn write_message_end(&mut self) -> Result<()>
Write the end of a Thrift message.
source§fn write_struct_begin(&mut self, _: &TStructIdentifier) -> Result<()>
fn write_struct_begin(&mut self, _: &TStructIdentifier) -> Result<()>
Write the beginning of a Thrift struct.
source§fn write_struct_end(&mut self) -> Result<()>
fn write_struct_end(&mut self) -> Result<()>
Write the end of a Thrift struct.
source§fn write_field_begin(&mut self, identifier: &TFieldIdentifier) -> Result<()>
fn write_field_begin(&mut self, identifier: &TFieldIdentifier) -> Result<()>
Write the beginning of a Thrift field.
source§fn write_field_end(&mut self) -> Result<()>
fn write_field_end(&mut self) -> Result<()>
Write the end of a Thrift field.
source§fn write_field_stop(&mut self) -> Result<()>
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_list_begin(&mut self, identifier: &TListIdentifier) -> Result<()>
fn write_list_begin(&mut self, identifier: &TListIdentifier) -> Result<()>
Write the beginning of a list.
source§fn write_list_end(&mut self) -> Result<()>
fn write_list_end(&mut self) -> Result<()>
Write the end of a list.
source§fn write_set_begin(&mut self, identifier: &TSetIdentifier) -> Result<()>
fn write_set_begin(&mut self, identifier: &TSetIdentifier) -> Result<()>
Write the beginning of a set.
source§fn write_set_end(&mut self) -> Result<()>
fn write_set_end(&mut self) -> Result<()>
Write the end of a set.
source§fn write_map_begin(&mut self, identifier: &TMapIdentifier) -> Result<()>
fn write_map_begin(&mut self, identifier: &TMapIdentifier) -> Result<()>
Write the beginning of a map.
source§fn write_map_end(&mut self) -> Result<()>
fn write_map_end(&mut self) -> Result<()>
Write the end of a map.
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> 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