// @generated by Thrift for thrift/compiler/test/fixtures/stream/src/module.thrift // This file is probably not the place you want to edit! //! Client implementation for each service in `module`. #![recursion_limit = "100000000"] #![allow(non_camel_case_types, non_snake_case, non_upper_case_globals, unused_crate_dependencies, unused_imports, clippy::all)] pub mod mock; #[doc(inline)] pub use :: as types; pub mod errors { #[doc(inline)] pub use ::::errors::pub_sub_streaming_service; #[doc(inline)] #[allow(ambiguous_glob_reexports)] pub use ::::errors::pub_sub_streaming_service::*; } pub(crate) use crate as client; pub(crate) use ::::services; // Used by Thrift-generated code to implement service inheritance. #[doc(hidden)] #[deprecated] pub mod dependencies { } /// Client definitions for `PubSubStreamingService`. pub struct PubSubStreamingServiceImpl
{
transport: T,
_phantom: ::std::marker::PhantomData PubSubStreamingServiceImpl
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Frame: ::fbthrift::Framing : ::fbthrift::BufMutExt ("returnstream", &args) {
::std::result::Result::Ok(res) => res,
::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(),
};
let call_stream = transport
.call_stream(SERVICE_NAME.as_cstr(), SERVICE_METHOD_NAME.as_cstr(), request_env, rpc_options)
.instrument(::tracing::trace_span!("call_stream", method = "PubSubStreamingService.returnstream"));
async move {
let (initial, stream) = call_stream.await?;
let new_stream = stream.then(|item_res| {
async move {
match item_res {
::std::result::Result::Err(err) =>
::std::result::Result::Err(crate::errors::pub_sub_streaming_service::ReturnstreamStreamError::from(err)),
::std::result::Result::Ok(item_enc) => {
let res = S::spawn(move || {
match item_enc {
::fbthrift::ClientStreamElement::Reply(payload) => {
let mut de = P::deserializer(payload);
crate::services::pub_sub_streaming_service::ReturnstreamStreamExn::read(&mut de)
}
::fbthrift::ClientStreamElement::ApplicationEx(payload) => {
let mut de = P::deserializer(payload);
::fbthrift::ApplicationException::read(&mut de).map(crate::services::pub_sub_streaming_service::ReturnstreamStreamExn::ApplicationException)
}
}
}).await?;
let item: ::std::result::Result<::std::primitive::i32, crate::errors::pub_sub_streaming_service::ReturnstreamStreamError> =
::std::convert::From::from(res);
item
}
}
}
})
.boxed();
let de = P::deserializer(initial);
let res: crate::services::pub_sub_streaming_service::ReturnstreamResponseExn =
::fbthrift::help::async_deserialize_response_envelope:: (de).await?.0?;
let initial: ::std::result::Result<(), crate::errors::pub_sub_streaming_service::ReturnstreamError> =
::std::convert::From::from(res);
let res = initial.map(move |_| new_stream);
res
}
.instrument(::tracing::info_span!("stream", method = "PubSubStreamingService.returnstream"))
.boxed()
}
fn _streamthrows_impl(
&self,
arg_foo: ::std::primitive::i32,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<::futures::stream::BoxStream<'static, ::std::result::Result<::std::primitive::i32, crate::errors::pub_sub_streaming_service::StreamthrowsStreamError>>, crate::errors::pub_sub_streaming_service::StreamthrowsError>> {
use ::const_cstr::const_cstr;
use ::tracing::Instrument as _;
use ::futures::FutureExt as _;
use ::futures::StreamExt as _;
use ::fbthrift::Deserialize as _;
const_cstr! {
SERVICE_NAME = "PubSubStreamingService";
SERVICE_METHOD_NAME = "PubSubStreamingService.streamthrows";
}
let args = self::Args_PubSubStreamingService_streamthrows {
foo: arg_foo,
_phantom: ::std::marker::PhantomData,
};
let transport = self.transport();
// need to do call setup outside of async block because T: Transport isn't Send
let request_env = match ::fbthrift::help::serialize_request_envelope:: ("streamthrows", &args) {
::std::result::Result::Ok(res) => res,
::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(),
};
let call_stream = transport
.call_stream(SERVICE_NAME.as_cstr(), SERVICE_METHOD_NAME.as_cstr(), request_env, rpc_options)
.instrument(::tracing::trace_span!("call_stream", method = "PubSubStreamingService.streamthrows"));
async move {
let (initial, stream) = call_stream.await?;
let new_stream = stream.then(|item_res| {
async move {
match item_res {
::std::result::Result::Err(err) =>
::std::result::Result::Err(crate::errors::pub_sub_streaming_service::StreamthrowsStreamError::from(err)),
::std::result::Result::Ok(item_enc) => {
let res = S::spawn(move || {
match item_enc {
::fbthrift::ClientStreamElement::Reply(payload) => {
let mut de = P::deserializer(payload);
crate::services::pub_sub_streaming_service::StreamthrowsStreamExn::read(&mut de)
}
::fbthrift::ClientStreamElement::ApplicationEx(payload) => {
let mut de = P::deserializer(payload);
::fbthrift::ApplicationException::read(&mut de).map(crate::services::pub_sub_streaming_service::StreamthrowsStreamExn::ApplicationException)
}
}
}).await?;
let item: ::std::result::Result<::std::primitive::i32, crate::errors::pub_sub_streaming_service::StreamthrowsStreamError> =
::std::convert::From::from(res);
item
}
}
}
})
.boxed();
let de = P::deserializer(initial);
let res: crate::services::pub_sub_streaming_service::StreamthrowsResponseExn =
::fbthrift::help::async_deserialize_response_envelope:: (de).await?.0?;
let initial: ::std::result::Result<(), crate::errors::pub_sub_streaming_service::StreamthrowsError> =
::std::convert::From::from(res);
let res = initial.map(move |_| new_stream);
res
}
.instrument(::tracing::info_span!("stream", method = "PubSubStreamingService.streamthrows"))
.boxed()
}
fn _servicethrows_impl(
&self,
arg_foo: ::std::primitive::i32,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<::futures::stream::BoxStream<'static, ::std::result::Result<::std::primitive::i32, crate::errors::pub_sub_streaming_service::ServicethrowsStreamError>>, crate::errors::pub_sub_streaming_service::ServicethrowsError>> {
use ::const_cstr::const_cstr;
use ::tracing::Instrument as _;
use ::futures::FutureExt as _;
use ::futures::StreamExt as _;
use ::fbthrift::Deserialize as _;
const_cstr! {
SERVICE_NAME = "PubSubStreamingService";
SERVICE_METHOD_NAME = "PubSubStreamingService.servicethrows";
}
let args = self::Args_PubSubStreamingService_servicethrows {
foo: arg_foo,
_phantom: ::std::marker::PhantomData,
};
let transport = self.transport();
// need to do call setup outside of async block because T: Transport isn't Send
let request_env = match ::fbthrift::help::serialize_request_envelope:: ("servicethrows", &args) {
::std::result::Result::Ok(res) => res,
::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(),
};
let call_stream = transport
.call_stream(SERVICE_NAME.as_cstr(), SERVICE_METHOD_NAME.as_cstr(), request_env, rpc_options)
.instrument(::tracing::trace_span!("call_stream", method = "PubSubStreamingService.servicethrows"));
async move {
let (initial, stream) = call_stream.await?;
let new_stream = stream.then(|item_res| {
async move {
match item_res {
::std::result::Result::Err(err) =>
::std::result::Result::Err(crate::errors::pub_sub_streaming_service::ServicethrowsStreamError::from(err)),
::std::result::Result::Ok(item_enc) => {
let res = S::spawn(move || {
match item_enc {
::fbthrift::ClientStreamElement::Reply(payload) => {
let mut de = P::deserializer(payload);
crate::services::pub_sub_streaming_service::ServicethrowsStreamExn::read(&mut de)
}
::fbthrift::ClientStreamElement::ApplicationEx(payload) => {
let mut de = P::deserializer(payload);
::fbthrift::ApplicationException::read(&mut de).map(crate::services::pub_sub_streaming_service::ServicethrowsStreamExn::ApplicationException)
}
}
}).await?;
let item: ::std::result::Result<::std::primitive::i32, crate::errors::pub_sub_streaming_service::ServicethrowsStreamError> =
::std::convert::From::from(res);
item
}
}
}
})
.boxed();
let de = P::deserializer(initial);
let res: crate::services::pub_sub_streaming_service::ServicethrowsResponseExn =
::fbthrift::help::async_deserialize_response_envelope:: (de).await?.0?;
let initial: ::std::result::Result<(), crate::errors::pub_sub_streaming_service::ServicethrowsError> =
::std::convert::From::from(res);
let res = initial.map(move |_| new_stream);
res
}
.instrument(::tracing::info_span!("stream", method = "PubSubStreamingService.servicethrows"))
.boxed()
}
fn _servicethrows2_impl(
&self,
arg_foo: ::std::primitive::i32,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<::futures::stream::BoxStream<'static, ::std::result::Result<::std::primitive::i32, crate::errors::pub_sub_streaming_service::Servicethrows2StreamError>>, crate::errors::pub_sub_streaming_service::Servicethrows2Error>> {
use ::const_cstr::const_cstr;
use ::tracing::Instrument as _;
use ::futures::FutureExt as _;
use ::futures::StreamExt as _;
use ::fbthrift::Deserialize as _;
const_cstr! {
SERVICE_NAME = "PubSubStreamingService";
SERVICE_METHOD_NAME = "PubSubStreamingService.servicethrows2";
}
let args = self::Args_PubSubStreamingService_servicethrows2 {
foo: arg_foo,
_phantom: ::std::marker::PhantomData,
};
let transport = self.transport();
// need to do call setup outside of async block because T: Transport isn't Send
let request_env = match ::fbthrift::help::serialize_request_envelope:: ("servicethrows2", &args) {
::std::result::Result::Ok(res) => res,
::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(),
};
let call_stream = transport
.call_stream(SERVICE_NAME.as_cstr(), SERVICE_METHOD_NAME.as_cstr(), request_env, rpc_options)
.instrument(::tracing::trace_span!("call_stream", method = "PubSubStreamingService.servicethrows2"));
async move {
let (initial, stream) = call_stream.await?;
let new_stream = stream.then(|item_res| {
async move {
match item_res {
::std::result::Result::Err(err) =>
::std::result::Result::Err(crate::errors::pub_sub_streaming_service::Servicethrows2StreamError::from(err)),
::std::result::Result::Ok(item_enc) => {
let res = S::spawn(move || {
match item_enc {
::fbthrift::ClientStreamElement::Reply(payload) => {
let mut de = P::deserializer(payload);
crate::services::pub_sub_streaming_service::Servicethrows2StreamExn::read(&mut de)
}
::fbthrift::ClientStreamElement::ApplicationEx(payload) => {
let mut de = P::deserializer(payload);
::fbthrift::ApplicationException::read(&mut de).map(crate::services::pub_sub_streaming_service::Servicethrows2StreamExn::ApplicationException)
}
}
}).await?;
let item: ::std::result::Result<::std::primitive::i32, crate::errors::pub_sub_streaming_service::Servicethrows2StreamError> =
::std::convert::From::from(res);
item
}
}
}
})
.boxed();
let de = P::deserializer(initial);
let res: crate::services::pub_sub_streaming_service::Servicethrows2ResponseExn =
::fbthrift::help::async_deserialize_response_envelope:: (de).await?.0?;
let initial: ::std::result::Result<(), crate::errors::pub_sub_streaming_service::Servicethrows2Error> =
::std::convert::From::from(res);
let res = initial.map(move |_| new_stream);
res
}
.instrument(::tracing::info_span!("stream", method = "PubSubStreamingService.servicethrows2"))
.boxed()
}
fn _boththrows_impl(
&self,
arg_foo: ::std::primitive::i32,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<::futures::stream::BoxStream<'static, ::std::result::Result<::std::primitive::i32, crate::errors::pub_sub_streaming_service::BoththrowsStreamError>>, crate::errors::pub_sub_streaming_service::BoththrowsError>> {
use ::const_cstr::const_cstr;
use ::tracing::Instrument as _;
use ::futures::FutureExt as _;
use ::futures::StreamExt as _;
use ::fbthrift::Deserialize as _;
const_cstr! {
SERVICE_NAME = "PubSubStreamingService";
SERVICE_METHOD_NAME = "PubSubStreamingService.boththrows";
}
let args = self::Args_PubSubStreamingService_boththrows {
foo: arg_foo,
_phantom: ::std::marker::PhantomData,
};
let transport = self.transport();
// need to do call setup outside of async block because T: Transport isn't Send
let request_env = match ::fbthrift::help::serialize_request_envelope:: ("boththrows", &args) {
::std::result::Result::Ok(res) => res,
::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(),
};
let call_stream = transport
.call_stream(SERVICE_NAME.as_cstr(), SERVICE_METHOD_NAME.as_cstr(), request_env, rpc_options)
.instrument(::tracing::trace_span!("call_stream", method = "PubSubStreamingService.boththrows"));
async move {
let (initial, stream) = call_stream.await?;
let new_stream = stream.then(|item_res| {
async move {
match item_res {
::std::result::Result::Err(err) =>
::std::result::Result::Err(crate::errors::pub_sub_streaming_service::BoththrowsStreamError::from(err)),
::std::result::Result::Ok(item_enc) => {
let res = S::spawn(move || {
match item_enc {
::fbthrift::ClientStreamElement::Reply(payload) => {
let mut de = P::deserializer(payload);
crate::services::pub_sub_streaming_service::BoththrowsStreamExn::read(&mut de)
}
::fbthrift::ClientStreamElement::ApplicationEx(payload) => {
let mut de = P::deserializer(payload);
::fbthrift::ApplicationException::read(&mut de).map(crate::services::pub_sub_streaming_service::BoththrowsStreamExn::ApplicationException)
}
}
}).await?;
let item: ::std::result::Result<::std::primitive::i32, crate::errors::pub_sub_streaming_service::BoththrowsStreamError> =
::std::convert::From::from(res);
item
}
}
}
})
.boxed();
let de = P::deserializer(initial);
let res: crate::services::pub_sub_streaming_service::BoththrowsResponseExn =
::fbthrift::help::async_deserialize_response_envelope:: (de).await?.0?;
let initial: ::std::result::Result<(), crate::errors::pub_sub_streaming_service::BoththrowsError> =
::std::convert::From::from(res);
let res = initial.map(move |_| new_stream);
res
}
.instrument(::tracing::info_span!("stream", method = "PubSubStreamingService.boththrows"))
.boxed()
}
fn _responseandstreamstreamthrows_impl(
&self,
arg_foo: ::std::primitive::i32,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(::std::primitive::i32, ::futures::stream::BoxStream<'static, ::std::result::Result<::std::primitive::i32, crate::errors::pub_sub_streaming_service::ResponseandstreamstreamthrowsStreamError>>), crate::errors::pub_sub_streaming_service::ResponseandstreamstreamthrowsError>> {
use ::const_cstr::const_cstr;
use ::tracing::Instrument as _;
use ::futures::FutureExt as _;
use ::futures::StreamExt as _;
use ::fbthrift::Deserialize as _;
const_cstr! {
SERVICE_NAME = "PubSubStreamingService";
SERVICE_METHOD_NAME = "PubSubStreamingService.responseandstreamstreamthrows";
}
let args = self::Args_PubSubStreamingService_responseandstreamstreamthrows {
foo: arg_foo,
_phantom: ::std::marker::PhantomData,
};
let transport = self.transport();
// need to do call setup outside of async block because T: Transport isn't Send
let request_env = match ::fbthrift::help::serialize_request_envelope:: ("responseandstreamstreamthrows", &args) {
::std::result::Result::Ok(res) => res,
::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(),
};
let call_stream = transport
.call_stream(SERVICE_NAME.as_cstr(), SERVICE_METHOD_NAME.as_cstr(), request_env, rpc_options)
.instrument(::tracing::trace_span!("call_stream", method = "PubSubStreamingService.responseandstreamstreamthrows"));
async move {
let (initial, stream) = call_stream.await?;
let new_stream = stream.then(|item_res| {
async move {
match item_res {
::std::result::Result::Err(err) =>
::std::result::Result::Err(crate::errors::pub_sub_streaming_service::ResponseandstreamstreamthrowsStreamError::from(err)),
::std::result::Result::Ok(item_enc) => {
let res = S::spawn(move || {
match item_enc {
::fbthrift::ClientStreamElement::Reply(payload) => {
let mut de = P::deserializer(payload);
crate::services::pub_sub_streaming_service::ResponseandstreamstreamthrowsStreamExn::read(&mut de)
}
::fbthrift::ClientStreamElement::ApplicationEx(payload) => {
let mut de = P::deserializer(payload);
::fbthrift::ApplicationException::read(&mut de).map(crate::services::pub_sub_streaming_service::ResponseandstreamstreamthrowsStreamExn::ApplicationException)
}
}
}).await?;
let item: ::std::result::Result<::std::primitive::i32, crate::errors::pub_sub_streaming_service::ResponseandstreamstreamthrowsStreamError> =
::std::convert::From::from(res);
item
}
}
}
})
.boxed();
let de = P::deserializer(initial);
let res: crate::services::pub_sub_streaming_service::ResponseandstreamstreamthrowsResponseExn =
::fbthrift::help::async_deserialize_response_envelope:: (de).await?.0?;
let initial: ::std::result::Result<::std::primitive::i32, crate::errors::pub_sub_streaming_service::ResponseandstreamstreamthrowsError> =
::std::convert::From::from(res);
let res = initial.map(move |initial| (initial, new_stream));
res
}
.instrument(::tracing::info_span!("stream", method = "PubSubStreamingService.responseandstreamstreamthrows"))
.boxed()
}
fn _responseandstreamservicethrows_impl(
&self,
arg_foo: ::std::primitive::i32,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(::std::primitive::i32, ::futures::stream::BoxStream<'static, ::std::result::Result<::std::primitive::i32, crate::errors::pub_sub_streaming_service::ResponseandstreamservicethrowsStreamError>>), crate::errors::pub_sub_streaming_service::ResponseandstreamservicethrowsError>> {
use ::const_cstr::const_cstr;
use ::tracing::Instrument as _;
use ::futures::FutureExt as _;
use ::futures::StreamExt as _;
use ::fbthrift::Deserialize as _;
const_cstr! {
SERVICE_NAME = "PubSubStreamingService";
SERVICE_METHOD_NAME = "PubSubStreamingService.responseandstreamservicethrows";
}
let args = self::Args_PubSubStreamingService_responseandstreamservicethrows {
foo: arg_foo,
_phantom: ::std::marker::PhantomData,
};
let transport = self.transport();
// need to do call setup outside of async block because T: Transport isn't Send
let request_env = match ::fbthrift::help::serialize_request_envelope:: ("responseandstreamservicethrows", &args) {
::std::result::Result::Ok(res) => res,
::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(),
};
let call_stream = transport
.call_stream(SERVICE_NAME.as_cstr(), SERVICE_METHOD_NAME.as_cstr(), request_env, rpc_options)
.instrument(::tracing::trace_span!("call_stream", method = "PubSubStreamingService.responseandstreamservicethrows"));
async move {
let (initial, stream) = call_stream.await?;
let new_stream = stream.then(|item_res| {
async move {
match item_res {
::std::result::Result::Err(err) =>
::std::result::Result::Err(crate::errors::pub_sub_streaming_service::ResponseandstreamservicethrowsStreamError::from(err)),
::std::result::Result::Ok(item_enc) => {
let res = S::spawn(move || {
match item_enc {
::fbthrift::ClientStreamElement::Reply(payload) => {
let mut de = P::deserializer(payload);
crate::services::pub_sub_streaming_service::ResponseandstreamservicethrowsStreamExn::read(&mut de)
}
::fbthrift::ClientStreamElement::ApplicationEx(payload) => {
let mut de = P::deserializer(payload);
::fbthrift::ApplicationException::read(&mut de).map(crate::services::pub_sub_streaming_service::ResponseandstreamservicethrowsStreamExn::ApplicationException)
}
}
}).await?;
let item: ::std::result::Result<::std::primitive::i32, crate::errors::pub_sub_streaming_service::ResponseandstreamservicethrowsStreamError> =
::std::convert::From::from(res);
item
}
}
}
})
.boxed();
let de = P::deserializer(initial);
let res: crate::services::pub_sub_streaming_service::ResponseandstreamservicethrowsResponseExn =
::fbthrift::help::async_deserialize_response_envelope:: (de).await?.0?;
let initial: ::std::result::Result<::std::primitive::i32, crate::errors::pub_sub_streaming_service::ResponseandstreamservicethrowsError> =
::std::convert::From::from(res);
let res = initial.map(move |initial| (initial, new_stream));
res
}
.instrument(::tracing::info_span!("stream", method = "PubSubStreamingService.responseandstreamservicethrows"))
.boxed()
}
fn _responseandstreamboththrows_impl(
&self,
arg_foo: ::std::primitive::i32,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(::std::primitive::i32, ::futures::stream::BoxStream<'static, ::std::result::Result<::std::primitive::i32, crate::errors::pub_sub_streaming_service::ResponseandstreamboththrowsStreamError>>), crate::errors::pub_sub_streaming_service::ResponseandstreamboththrowsError>> {
use ::const_cstr::const_cstr;
use ::tracing::Instrument as _;
use ::futures::FutureExt as _;
use ::futures::StreamExt as _;
use ::fbthrift::Deserialize as _;
const_cstr! {
SERVICE_NAME = "PubSubStreamingService";
SERVICE_METHOD_NAME = "PubSubStreamingService.responseandstreamboththrows";
}
let args = self::Args_PubSubStreamingService_responseandstreamboththrows {
foo: arg_foo,
_phantom: ::std::marker::PhantomData,
};
let transport = self.transport();
// need to do call setup outside of async block because T: Transport isn't Send
let request_env = match ::fbthrift::help::serialize_request_envelope:: ("responseandstreamboththrows", &args) {
::std::result::Result::Ok(res) => res,
::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(),
};
let call_stream = transport
.call_stream(SERVICE_NAME.as_cstr(), SERVICE_METHOD_NAME.as_cstr(), request_env, rpc_options)
.instrument(::tracing::trace_span!("call_stream", method = "PubSubStreamingService.responseandstreamboththrows"));
async move {
let (initial, stream) = call_stream.await?;
let new_stream = stream.then(|item_res| {
async move {
match item_res {
::std::result::Result::Err(err) =>
::std::result::Result::Err(crate::errors::pub_sub_streaming_service::ResponseandstreamboththrowsStreamError::from(err)),
::std::result::Result::Ok(item_enc) => {
let res = S::spawn(move || {
match item_enc {
::fbthrift::ClientStreamElement::Reply(payload) => {
let mut de = P::deserializer(payload);
crate::services::pub_sub_streaming_service::ResponseandstreamboththrowsStreamExn::read(&mut de)
}
::fbthrift::ClientStreamElement::ApplicationEx(payload) => {
let mut de = P::deserializer(payload);
::fbthrift::ApplicationException::read(&mut de).map(crate::services::pub_sub_streaming_service::ResponseandstreamboththrowsStreamExn::ApplicationException)
}
}
}).await?;
let item: ::std::result::Result<::std::primitive::i32, crate::errors::pub_sub_streaming_service::ResponseandstreamboththrowsStreamError> =
::std::convert::From::from(res);
item
}
}
}
})
.boxed();
let de = P::deserializer(initial);
let res: crate::services::pub_sub_streaming_service::ResponseandstreamboththrowsResponseExn =
::fbthrift::help::async_deserialize_response_envelope:: (de).await?.0?;
let initial: ::std::result::Result<::std::primitive::i32, crate::errors::pub_sub_streaming_service::ResponseandstreamboththrowsError> =
::std::convert::From::from(res);
let res = initial.map(move |initial| (initial, new_stream));
res
}
.instrument(::tracing::info_span!("stream", method = "PubSubStreamingService.responseandstreamboththrows"))
.boxed()
}
fn _returnstreamFast_impl(
&self,
arg_i32_from: ::std::primitive::i32,
arg_i32_to: ::std::primitive::i32,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<::futures::stream::BoxStream<'static, ::std::result::Result<::std::primitive::i32, crate::errors::pub_sub_streaming_service::ReturnstreamFastStreamError>>, crate::errors::pub_sub_streaming_service::ReturnstreamFastError>> {
use ::const_cstr::const_cstr;
use ::tracing::Instrument as _;
use ::futures::FutureExt as _;
use ::futures::StreamExt as _;
use ::fbthrift::Deserialize as _;
const_cstr! {
SERVICE_NAME = "PubSubStreamingService";
SERVICE_METHOD_NAME = "PubSubStreamingService.returnstreamFast";
}
let args = self::Args_PubSubStreamingService_returnstreamFast {
i32_from: arg_i32_from,
i32_to: arg_i32_to,
_phantom: ::std::marker::PhantomData,
};
let transport = self.transport();
// need to do call setup outside of async block because T: Transport isn't Send
let request_env = match ::fbthrift::help::serialize_request_envelope:: ("returnstreamFast", &args) {
::std::result::Result::Ok(res) => res,
::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(),
};
let call_stream = transport
.call_stream(SERVICE_NAME.as_cstr(), SERVICE_METHOD_NAME.as_cstr(), request_env, rpc_options)
.instrument(::tracing::trace_span!("call_stream", method = "PubSubStreamingService.returnstreamFast"));
async move {
let (initial, stream) = call_stream.await?;
let new_stream = stream.then(|item_res| {
async move {
match item_res {
::std::result::Result::Err(err) =>
::std::result::Result::Err(crate::errors::pub_sub_streaming_service::ReturnstreamFastStreamError::from(err)),
::std::result::Result::Ok(item_enc) => {
let res = S::spawn(move || {
match item_enc {
::fbthrift::ClientStreamElement::Reply(payload) => {
let mut de = P::deserializer(payload);
crate::services::pub_sub_streaming_service::ReturnstreamFastStreamExn::read(&mut de)
}
::fbthrift::ClientStreamElement::ApplicationEx(payload) => {
let mut de = P::deserializer(payload);
::fbthrift::ApplicationException::read(&mut de).map(crate::services::pub_sub_streaming_service::ReturnstreamFastStreamExn::ApplicationException)
}
}
}).await?;
let item: ::std::result::Result<::std::primitive::i32, crate::errors::pub_sub_streaming_service::ReturnstreamFastStreamError> =
::std::convert::From::from(res);
item
}
}
}
})
.boxed();
let de = P::deserializer(initial);
let res: crate::services::pub_sub_streaming_service::ReturnstreamFastResponseExn =
::fbthrift::help::async_deserialize_response_envelope:: (de).await?.0?;
let initial: ::std::result::Result<(), crate::errors::pub_sub_streaming_service::ReturnstreamFastError> =
::std::convert::From::from(res);
let res = initial.map(move |_| new_stream);
res
}
.instrument(::tracing::info_span!("stream", method = "PubSubStreamingService.returnstreamFast"))
.boxed()
}
}
pub trait PubSubStreamingService: ::std::marker::Send {
fn returnstream(
&self,
arg_i32_from: ::std::primitive::i32,
arg_i32_to: ::std::primitive::i32,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<::futures::stream::BoxStream<'static, ::std::result::Result<::std::primitive::i32, crate::errors::pub_sub_streaming_service::ReturnstreamStreamError>>, crate::errors::pub_sub_streaming_service::ReturnstreamError>>;
fn streamthrows(
&self,
arg_foo: ::std::primitive::i32,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<::futures::stream::BoxStream<'static, ::std::result::Result<::std::primitive::i32, crate::errors::pub_sub_streaming_service::StreamthrowsStreamError>>, crate::errors::pub_sub_streaming_service::StreamthrowsError>>;
fn servicethrows(
&self,
arg_foo: ::std::primitive::i32,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<::futures::stream::BoxStream<'static, ::std::result::Result<::std::primitive::i32, crate::errors::pub_sub_streaming_service::ServicethrowsStreamError>>, crate::errors::pub_sub_streaming_service::ServicethrowsError>>;
fn servicethrows2(
&self,
arg_foo: ::std::primitive::i32,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<::futures::stream::BoxStream<'static, ::std::result::Result<::std::primitive::i32, crate::errors::pub_sub_streaming_service::Servicethrows2StreamError>>, crate::errors::pub_sub_streaming_service::Servicethrows2Error>>;
fn boththrows(
&self,
arg_foo: ::std::primitive::i32,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<::futures::stream::BoxStream<'static, ::std::result::Result<::std::primitive::i32, crate::errors::pub_sub_streaming_service::BoththrowsStreamError>>, crate::errors::pub_sub_streaming_service::BoththrowsError>>;
fn responseandstreamstreamthrows(
&self,
arg_foo: ::std::primitive::i32,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(::std::primitive::i32, ::futures::stream::BoxStream<'static, ::std::result::Result<::std::primitive::i32, crate::errors::pub_sub_streaming_service::ResponseandstreamstreamthrowsStreamError>>), crate::errors::pub_sub_streaming_service::ResponseandstreamstreamthrowsError>>;
fn responseandstreamservicethrows(
&self,
arg_foo: ::std::primitive::i32,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(::std::primitive::i32, ::futures::stream::BoxStream<'static, ::std::result::Result<::std::primitive::i32, crate::errors::pub_sub_streaming_service::ResponseandstreamservicethrowsStreamError>>), crate::errors::pub_sub_streaming_service::ResponseandstreamservicethrowsError>>;
fn responseandstreamboththrows(
&self,
arg_foo: ::std::primitive::i32,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(::std::primitive::i32, ::futures::stream::BoxStream<'static, ::std::result::Result<::std::primitive::i32, crate::errors::pub_sub_streaming_service::ResponseandstreamboththrowsStreamError>>), crate::errors::pub_sub_streaming_service::ResponseandstreamboththrowsError>>;
fn returnstreamFast(
&self,
arg_i32_from: ::std::primitive::i32,
arg_i32_to: ::std::primitive::i32,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<::futures::stream::BoxStream<'static, ::std::result::Result<::std::primitive::i32, crate::errors::pub_sub_streaming_service::ReturnstreamFastStreamError>>, crate::errors::pub_sub_streaming_service::ReturnstreamFastError>>;
}
pub trait PubSubStreamingServiceExt for self::Args_PubSubStreamingService_returnstream<'a> {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "PubSubStreamingService.returnstream"))]
fn write(&self, p: &mut P) {
p.write_struct_begin("args");
p.write_field_begin("i32_from", ::fbthrift::TType::I32, 1i16);
::fbthrift::Serialize::write(&self.i32_from, p);
p.write_field_end();
p.write_field_begin("i32_to", ::fbthrift::TType::I32, 2i16);
::fbthrift::Serialize::write(&self.i32_to, p);
p.write_field_end();
p.write_field_stop();
p.write_struct_end();
}
}
struct Args_PubSubStreamingService_streamthrows<'a> {
foo: ::std::primitive::i32,
_phantom: ::std::marker::PhantomData<&'a ()>,
}
impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize for self::Args_PubSubStreamingService_streamthrows<'a> {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "PubSubStreamingService.streamthrows"))]
fn write(&self, p: &mut P) {
p.write_struct_begin("args");
p.write_field_begin("foo", ::fbthrift::TType::I32, 1i16);
::fbthrift::Serialize::write(&self.foo, p);
p.write_field_end();
p.write_field_stop();
p.write_struct_end();
}
}
struct Args_PubSubStreamingService_servicethrows<'a> {
foo: ::std::primitive::i32,
_phantom: ::std::marker::PhantomData<&'a ()>,
}
impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize for self::Args_PubSubStreamingService_servicethrows<'a> {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "PubSubStreamingService.servicethrows"))]
fn write(&self, p: &mut P) {
p.write_struct_begin("args");
p.write_field_begin("foo", ::fbthrift::TType::I32, 1i16);
::fbthrift::Serialize::write(&self.foo, p);
p.write_field_end();
p.write_field_stop();
p.write_struct_end();
}
}
struct Args_PubSubStreamingService_servicethrows2<'a> {
foo: ::std::primitive::i32,
_phantom: ::std::marker::PhantomData<&'a ()>,
}
impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize for self::Args_PubSubStreamingService_servicethrows2<'a> {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "PubSubStreamingService.servicethrows2"))]
fn write(&self, p: &mut P) {
p.write_struct_begin("args");
p.write_field_begin("foo", ::fbthrift::TType::I32, 1i16);
::fbthrift::Serialize::write(&self.foo, p);
p.write_field_end();
p.write_field_stop();
p.write_struct_end();
}
}
struct Args_PubSubStreamingService_boththrows<'a> {
foo: ::std::primitive::i32,
_phantom: ::std::marker::PhantomData<&'a ()>,
}
impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize for self::Args_PubSubStreamingService_boththrows<'a> {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "PubSubStreamingService.boththrows"))]
fn write(&self, p: &mut P) {
p.write_struct_begin("args");
p.write_field_begin("foo", ::fbthrift::TType::I32, 1i16);
::fbthrift::Serialize::write(&self.foo, p);
p.write_field_end();
p.write_field_stop();
p.write_struct_end();
}
}
struct Args_PubSubStreamingService_responseandstreamstreamthrows<'a> {
foo: ::std::primitive::i32,
_phantom: ::std::marker::PhantomData<&'a ()>,
}
impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize for self::Args_PubSubStreamingService_responseandstreamstreamthrows<'a> {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "PubSubStreamingService.responseandstreamstreamthrows"))]
fn write(&self, p: &mut P) {
p.write_struct_begin("args");
p.write_field_begin("foo", ::fbthrift::TType::I32, 1i16);
::fbthrift::Serialize::write(&self.foo, p);
p.write_field_end();
p.write_field_stop();
p.write_struct_end();
}
}
struct Args_PubSubStreamingService_responseandstreamservicethrows<'a> {
foo: ::std::primitive::i32,
_phantom: ::std::marker::PhantomData<&'a ()>,
}
impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize for self::Args_PubSubStreamingService_responseandstreamservicethrows<'a> {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "PubSubStreamingService.responseandstreamservicethrows"))]
fn write(&self, p: &mut P) {
p.write_struct_begin("args");
p.write_field_begin("foo", ::fbthrift::TType::I32, 1i16);
::fbthrift::Serialize::write(&self.foo, p);
p.write_field_end();
p.write_field_stop();
p.write_struct_end();
}
}
struct Args_PubSubStreamingService_responseandstreamboththrows<'a> {
foo: ::std::primitive::i32,
_phantom: ::std::marker::PhantomData<&'a ()>,
}
impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize for self::Args_PubSubStreamingService_responseandstreamboththrows<'a> {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "PubSubStreamingService.responseandstreamboththrows"))]
fn write(&self, p: &mut P) {
p.write_struct_begin("args");
p.write_field_begin("foo", ::fbthrift::TType::I32, 1i16);
::fbthrift::Serialize::write(&self.foo, p);
p.write_field_end();
p.write_field_stop();
p.write_struct_end();
}
}
struct Args_PubSubStreamingService_returnstreamFast<'a> {
i32_from: ::std::primitive::i32,
i32_to: ::std::primitive::i32,
_phantom: ::std::marker::PhantomData<&'a ()>,
}
impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize for self::Args_PubSubStreamingService_returnstreamFast<'a> {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "PubSubStreamingService.returnstreamFast"))]
fn write(&self, p: &mut P) {
p.write_struct_begin("args");
p.write_field_begin("i32_from", ::fbthrift::TType::I32, 1i16);
::fbthrift::Serialize::write(&self.i32_from, p);
p.write_field_end();
p.write_field_begin("i32_to", ::fbthrift::TType::I32, 2i16);
::fbthrift::Serialize::write(&self.i32_to, p);
p.write_field_end();
p.write_field_stop();
p.write_struct_end();
}
}
impl PubSubStreamingService for PubSubStreamingServiceImpl
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Frame: ::fbthrift::Framing : ::fbthrift::BufMutExt PubSubStreamingServiceExt
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Frame: ::fbthrift::Framing : ::fbthrift::BufMutExt (
protocol: P,
transport: T,
) -> ::std::sync::Arc (
protocol: P,
transport: T,
spawner: S,
) -> ::std::sync::Arc ::new(transport))
}
}
impl (
protocol: P,
transport: T,
) -> ::std::sync::Arc (
protocol: P,
transport: T,
spawner: S,
) -> ::std::sync::Arc ::new(transport))
}
}
pub type PubSubStreamingServiceDynClient = (protocol: P, transport: T, spawner: S) -> ::std::sync::Arc PubSubStreamingServiceExt