[−][src]Struct thrift::protocol::TStoredInputProtocol
TInputProtocol
required to use a TMultiplexedProcessor
.
A TMultiplexedProcessor
reads incoming message identifiers to determine to
which TProcessor
requests should be forwarded. However, once read, those
message identifier bytes are no longer on the wire. Since downstream
processors expect to read message identifiers from the given input protocol
we need some way of supplying a TMessageIdentifier
with the service-name
stripped. This implementation stores the received TMessageIdentifier
(without the service name) and passes it to the wrapped TInputProtocol
when TInputProtocol::read_message_begin(...)
is called. It delegates all
other calls directly to the wrapped TInputProtocol
.
This type should not be used by application code.
Examples
Create and use a TStoredInputProtocol
.
use thrift::protocol::{TInputProtocol, TMessageIdentifier, TMessageType, TOutputProtocol}; use thrift::protocol::{TBinaryInputProtocol, TBinaryOutputProtocol, TStoredInputProtocol}; use thrift::server::TProcessor; use thrift::transport::{TIoChannel, TTcpChannel}; // sample processor struct ActualProcessor; impl TProcessor for ActualProcessor { fn process( &self, _: &mut TInputProtocol, _: &mut TOutputProtocol ) -> thrift::Result<()> { unimplemented!() } } let processor = ActualProcessor {}; // construct the shared transport let mut channel = TTcpChannel::new(); channel.open("localhost:9090").unwrap(); let (i_chan, o_chan) = channel.split().unwrap(); // construct the actual input and output protocols let mut i_prot = TBinaryInputProtocol::new(i_chan, true); let mut o_prot = TBinaryOutputProtocol::new(o_chan, true); // message identifier received from remote and modified to remove the service name let new_msg_ident = TMessageIdentifier::new("service_call", TMessageType::Call, 1); // construct the proxy input protocol let mut proxy_i_prot = TStoredInputProtocol::new(&mut i_prot, new_msg_ident); let res = processor.process(&mut proxy_i_prot, &mut o_prot);
Methods
impl<'a> TStoredInputProtocol<'a>
[src]
pub fn new(
wrapped: &mut dyn TInputProtocol,
message_ident: TMessageIdentifier
) -> TStoredInputProtocol
[src]
wrapped: &mut dyn TInputProtocol,
message_ident: TMessageIdentifier
) -> TStoredInputProtocol
Create a TStoredInputProtocol
that delegates all calls other than
TInputProtocol::read_message_begin(...)
to a wrapped
TInputProtocol
. message_ident
is the modified message identifier -
with service name stripped - that will be passed to
wrapped.read_message_begin(...)
.
Trait Implementations
impl<'a> TInputProtocol for TStoredInputProtocol<'a>
[src]
fn read_message_begin(&mut self) -> Result<TMessageIdentifier>
[src]
fn read_message_end(&mut self) -> Result<()>
[src]
fn read_struct_begin(&mut self) -> Result<Option<TStructIdentifier>>
[src]
fn read_struct_end(&mut self) -> Result<()>
[src]
fn read_field_begin(&mut self) -> Result<TFieldIdentifier>
[src]
fn read_field_end(&mut self) -> Result<()>
[src]
fn read_bytes(&mut self) -> Result<Vec<u8>>
[src]
fn read_bool(&mut self) -> Result<bool>
[src]
fn read_i8(&mut self) -> Result<i8>
[src]
fn read_i16(&mut self) -> Result<i16>
[src]
fn read_i32(&mut self) -> Result<i32>
[src]
fn read_i64(&mut self) -> Result<i64>
[src]
fn read_double(&mut self) -> Result<f64>
[src]
fn read_string(&mut self) -> Result<String>
[src]
fn read_list_begin(&mut self) -> Result<TListIdentifier>
[src]
fn read_list_end(&mut self) -> Result<()>
[src]
fn read_set_begin(&mut self) -> Result<TSetIdentifier>
[src]
fn read_set_end(&mut self) -> Result<()>
[src]
fn read_map_begin(&mut self) -> Result<TMapIdentifier>
[src]
fn read_map_end(&mut self) -> Result<()>
[src]
fn read_byte(&mut self) -> Result<u8>
[src]
fn skip(&mut self, field_type: TType) -> Result<()>
[src]
fn skip_till_depth(&mut self, field_type: TType, depth: i8) -> Result<()>
[src]
Auto Trait Implementations
impl<'a> !Send for TStoredInputProtocol<'a>
impl<'a> !Sync for TStoredInputProtocol<'a>
impl<'a> Unpin for TStoredInputProtocol<'a>
impl<'a> !UnwindSafe for TStoredInputProtocol<'a>
impl<'a> !RefUnwindSafe for TStoredInputProtocol<'a>
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,