[−][src]Struct thrift::protocol::TMultiplexedOutputProtocol
TOutputProtocol
that prefixes the service name to all outgoing Thrift
messages.
A TMultiplexedOutputProtocol
should be used when multiple Thrift services
send messages over a single I/O channel. By prefixing service identifiers
to outgoing messages receivers are able to demux them and route them to the
appropriate service processor. Rust receivers must use a TMultiplexedProcessor
to process incoming messages, while other languages must use their
corresponding multiplexed processor implementations.
For example, given a service TestService
and a service call test_call
,
this implementation would identify messages as originating from
TestService:test_call
.
Examples
Create and use a TMultiplexedOutputProtocol
.
use thrift::protocol::{TMessageIdentifier, TMessageType, TOutputProtocol}; use thrift::protocol::{TBinaryOutputProtocol, TMultiplexedOutputProtocol}; use thrift::transport::TTcpChannel; let mut channel = TTcpChannel::new(); channel.open("localhost:9090").unwrap(); let protocol = TBinaryOutputProtocol::new(channel, true); let mut protocol = TMultiplexedOutputProtocol::new("service_name", protocol); let ident = TMessageIdentifier::new("svc_call", TMessageType::Call, 1); protocol.write_message_begin(&ident).unwrap();
Methods
impl<P> TMultiplexedOutputProtocol<P> where
P: TOutputProtocol,
[src]
P: TOutputProtocol,
pub fn new(service_name: &str, wrapped: P) -> TMultiplexedOutputProtocol<P>
[src]
Create a TMultiplexedOutputProtocol
that identifies outgoing messages
as originating from a service named service_name
and sends them over
the wrapped
TOutputProtocol
. Outgoing messages are encoded and sent
by wrapped
, not by this instance.
Trait Implementations
impl<P> TOutputProtocol for TMultiplexedOutputProtocol<P> where
P: TOutputProtocol,
[src]
P: TOutputProtocol,
fn write_message_begin(&mut self, identifier: &TMessageIdentifier) -> Result<()>
[src]
fn write_message_end(&mut self) -> Result<()>
[src]
fn write_struct_begin(&mut self, identifier: &TStructIdentifier) -> Result<()>
[src]
fn write_struct_end(&mut self) -> Result<()>
[src]
fn write_field_begin(&mut self, identifier: &TFieldIdentifier) -> Result<()>
[src]
fn write_field_end(&mut self) -> Result<()>
[src]
fn write_field_stop(&mut self) -> Result<()>
[src]
fn write_bytes(&mut self, b: &[u8]) -> Result<()>
[src]
fn write_bool(&mut self, b: bool) -> Result<()>
[src]
fn write_i8(&mut self, i: i8) -> Result<()>
[src]
fn write_i16(&mut self, i: i16) -> Result<()>
[src]
fn write_i32(&mut self, i: i32) -> Result<()>
[src]
fn write_i64(&mut self, i: i64) -> Result<()>
[src]
fn write_double(&mut self, d: f64) -> Result<()>
[src]
fn write_string(&mut self, s: &str) -> Result<()>
[src]
fn write_list_begin(&mut self, identifier: &TListIdentifier) -> Result<()>
[src]
fn write_list_end(&mut self) -> Result<()>
[src]
fn write_set_begin(&mut self, identifier: &TSetIdentifier) -> Result<()>
[src]
fn write_set_end(&mut self) -> Result<()>
[src]
fn write_map_begin(&mut self, identifier: &TMapIdentifier) -> Result<()>
[src]
fn write_map_end(&mut self) -> Result<()>
[src]
fn flush(&mut self) -> Result<()>
[src]
fn write_byte(&mut self, b: u8) -> Result<()>
[src]
impl<P: Debug> Debug for TMultiplexedOutputProtocol<P> where
P: TOutputProtocol,
[src]
P: TOutputProtocol,
Auto Trait Implementations
impl<P> Send for TMultiplexedOutputProtocol<P> where
P: Send,
P: Send,
impl<P> Sync for TMultiplexedOutputProtocol<P> where
P: Sync,
P: Sync,
impl<P> Unpin for TMultiplexedOutputProtocol<P> where
P: Unpin,
P: Unpin,
impl<P> UnwindSafe for TMultiplexedOutputProtocol<P> where
P: UnwindSafe,
P: UnwindSafe,
impl<P> RefUnwindSafe for TMultiplexedOutputProtocol<P> where
P: RefUnwindSafe,
P: RefUnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,