[][src]Struct thrift::protocol::TMultiplexedOutputProtocol

pub struct TMultiplexedOutputProtocol<P> where
    P: TOutputProtocol
{ /* fields omitted */ }

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]

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]

impl<P: Debug> Debug for TMultiplexedOutputProtocol<P> where
    P: TOutputProtocol
[src]

Auto Trait Implementations

impl<P> Send for TMultiplexedOutputProtocol<P> where
    P: Send

impl<P> Sync for TMultiplexedOutputProtocol<P> where
    P: Sync

impl<P> Unpin for TMultiplexedOutputProtocol<P> where
    P: Unpin

impl<P> UnwindSafe for TMultiplexedOutputProtocol<P> where
    P: UnwindSafe

impl<P> RefUnwindSafe for TMultiplexedOutputProtocol<P> where
    P: RefUnwindSafe

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]