// @generated by Thrift for thrift/compiler/test/fixtures/interactions/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)] #[doc(inline)] pub use :: as types; pub mod errors { #[doc(inline)] pub use ::::errors::my_service; #[doc(inline)] #[allow(ambiguous_glob_reexports)] pub use ::::errors::my_service::*; #[doc(inline)] pub use ::::errors::my_interaction; #[doc(inline)] #[allow(ambiguous_glob_reexports)] pub use ::::errors::my_interaction::*; #[doc(inline)] pub use ::::errors::my_interaction_fast; #[doc(inline)] #[allow(ambiguous_glob_reexports)] pub use ::::errors::my_interaction_fast::*; #[doc(inline)] pub use ::::errors::serial_interaction; #[doc(inline)] #[allow(ambiguous_glob_reexports)] pub use ::::errors::serial_interaction::*; } 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 `MyInteraction`. pub struct MyInteractionImpl
{
transport: T,
_phantom: ::std::marker::PhantomData MyInteractionImpl
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Frame: ::fbthrift::Framing : ::fbthrift::BufMutExt ("MyInteraction.frobnicate", &args) {
::std::result::Result::Ok(res) => res,
::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(),
};
let call = transport
.call(SERVICE_NAME.as_cstr(), SERVICE_METHOD_NAME.as_cstr(), request_env, rpc_options)
.instrument(::tracing::trace_span!("call", method = "MyInteraction.frobnicate"));
async move {
let reply_env = call.await?;
let de = P::deserializer(reply_env);
let res = ::fbthrift::help::async_deserialize_response_envelope:: (de).await?;
let res = match res {
::std::result::Result::Ok(res) => res,
::std::result::Result::Err(aexn) => {
::std::result::Result::Err(crate::errors::my_interaction::FrobnicateError::ApplicationException(aexn))
}
};
res
}
.instrument(::tracing::info_span!("stream", method = "MyInteraction.frobnicate"))
.boxed()
}
fn _ping_impl(
&self,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::my_interaction::PingError>> {
use ::const_cstr::const_cstr;
use ::tracing::Instrument as _;
use ::futures::FutureExt as _;
const_cstr! {
SERVICE_NAME = "MyService";
SERVICE_METHOD_NAME = "MyService.MyInteraction.ping";
}
let args = self::Args_MyInteraction_ping {
_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:: ("MyInteraction.ping", &args) {
::std::result::Result::Ok(res) => res,
::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(),
};
let call = transport
.call(SERVICE_NAME.as_cstr(), SERVICE_METHOD_NAME.as_cstr(), request_env, rpc_options)
.instrument(::tracing::trace_span!("call", method = "MyInteraction.ping"));
async move {
let reply_env = call.await?;
let de = P::deserializer(reply_env);
let res = ::fbthrift::help::async_deserialize_response_envelope:: (de).await?;
let res = match res {
::std::result::Result::Ok(res) => res,
::std::result::Result::Err(aexn) => {
::std::result::Result::Err(crate::errors::my_interaction::PingError::ApplicationException(aexn))
}
};
res
}
.instrument(::tracing::info_span!("stream", method = "MyInteraction.ping"))
.boxed()
}
fn _truthify_impl(
&self,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<::futures::stream::BoxStream<'static, ::std::result::Result<::std::primitive::bool, crate::errors::my_interaction::TruthifyStreamError>>, crate::errors::my_interaction::TruthifyError>> {
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 = "MyService";
SERVICE_METHOD_NAME = "MyService.MyInteraction.truthify";
}
let args = self::Args_MyInteraction_truthify {
_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:: ("MyInteraction.truthify", &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 = "MyInteraction.truthify"));
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::my_interaction::TruthifyStreamError::from(err)),
::std::result::Result::Ok(item_enc) => {
S::spawn(move || {
match item_enc {
::fbthrift::ClientStreamElement::Reply(payload) => {
let mut de = P::deserializer(payload);
(de)
.await??
.map(move |_| new_stream);
res
}
.instrument(::tracing::info_span!("stream", method = "MyInteraction.truthify"))
.boxed()
}
}
pub trait MyInteraction: ::std::marker::Send {
fn frobnicate(
&self,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<::std::primitive::i32, crate::errors::my_interaction::FrobnicateError>>;
fn ping(
&self,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::my_interaction::PingError>>;
fn truthify(
&self,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<::futures::stream::BoxStream<'static, ::std::result::Result<::std::primitive::bool, crate::errors::my_interaction::TruthifyStreamError>>, crate::errors::my_interaction::TruthifyError>>;
}
pub trait MyInteractionExt for self::Args_MyInteraction_frobnicate<'a> {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "MyInteraction.frobnicate"))]
fn write(&self, p: &mut P) {
p.write_struct_begin("args");
p.write_field_stop();
p.write_struct_end();
}
}
struct Args_MyInteraction_ping<'a> {
_phantom: ::std::marker::PhantomData<&'a ()>,
}
impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize for self::Args_MyInteraction_ping<'a> {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "MyInteraction.ping"))]
fn write(&self, p: &mut P) {
p.write_struct_begin("args");
p.write_field_stop();
p.write_struct_end();
}
}
struct Args_MyInteraction_truthify<'a> {
_phantom: ::std::marker::PhantomData<&'a ()>,
}
impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize for self::Args_MyInteraction_truthify<'a> {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "MyInteraction.truthify"))]
fn write(&self, p: &mut P) {
p.write_struct_begin("args");
p.write_field_stop();
p.write_struct_end();
}
}
impl MyInteraction for MyInteractionImpl
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Frame: ::fbthrift::Framing : ::fbthrift::BufMutExt MyInteractionExt
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 MyInteractionDynClient = (protocol: P, transport: T, spawner: S) -> ::std::sync::Arc {
transport: T,
_phantom: ::std::marker::PhantomData MyInteractionFastImpl
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Frame: ::fbthrift::Framing : ::fbthrift::BufMutExt ("MyInteractionFast.frobnicate", &args) {
::std::result::Result::Ok(res) => res,
::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(),
};
let call = transport
.call(SERVICE_NAME.as_cstr(), SERVICE_METHOD_NAME.as_cstr(), request_env, rpc_options)
.instrument(::tracing::trace_span!("call", method = "MyInteractionFast.frobnicate"));
async move {
let reply_env = call.await?;
let de = P::deserializer(reply_env);
let res = ::fbthrift::help::async_deserialize_response_envelope:: (de).await?;
let res = match res {
::std::result::Result::Ok(res) => res,
::std::result::Result::Err(aexn) => {
::std::result::Result::Err(crate::errors::my_interaction_fast::FrobnicateError::ApplicationException(aexn))
}
};
res
}
.instrument(::tracing::info_span!("stream", method = "MyInteractionFast.frobnicate"))
.boxed()
}
fn _ping_impl(
&self,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::my_interaction_fast::PingError>> {
use ::const_cstr::const_cstr;
use ::tracing::Instrument as _;
use ::futures::FutureExt as _;
const_cstr! {
SERVICE_NAME = "MyService";
SERVICE_METHOD_NAME = "MyService.MyInteractionFast.ping";
}
let args = self::Args_MyInteractionFast_ping {
_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:: ("MyInteractionFast.ping", &args) {
::std::result::Result::Ok(res) => res,
::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(),
};
let call = transport
.call(SERVICE_NAME.as_cstr(), SERVICE_METHOD_NAME.as_cstr(), request_env, rpc_options)
.instrument(::tracing::trace_span!("call", method = "MyInteractionFast.ping"));
async move {
let reply_env = call.await?;
let de = P::deserializer(reply_env);
let res = ::fbthrift::help::async_deserialize_response_envelope:: (de).await?;
let res = match res {
::std::result::Result::Ok(res) => res,
::std::result::Result::Err(aexn) => {
::std::result::Result::Err(crate::errors::my_interaction_fast::PingError::ApplicationException(aexn))
}
};
res
}
.instrument(::tracing::info_span!("stream", method = "MyInteractionFast.ping"))
.boxed()
}
fn _truthify_impl(
&self,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<::futures::stream::BoxStream<'static, ::std::result::Result<::std::primitive::bool, crate::errors::my_interaction_fast::TruthifyStreamError>>, crate::errors::my_interaction_fast::TruthifyError>> {
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 = "MyService";
SERVICE_METHOD_NAME = "MyService.MyInteractionFast.truthify";
}
let args = self::Args_MyInteractionFast_truthify {
_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:: ("MyInteractionFast.truthify", &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 = "MyInteractionFast.truthify"));
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::my_interaction_fast::TruthifyStreamError::from(err)),
::std::result::Result::Ok(item_enc) => {
S::spawn(move || {
match item_enc {
::fbthrift::ClientStreamElement::Reply(payload) => {
let mut de = P::deserializer(payload);
(de)
.await??
.map(move |_| new_stream);
res
}
.instrument(::tracing::info_span!("stream", method = "MyInteractionFast.truthify"))
.boxed()
}
}
pub trait MyInteractionFast: ::std::marker::Send {
fn frobnicate(
&self,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<::std::primitive::i32, crate::errors::my_interaction_fast::FrobnicateError>>;
fn ping(
&self,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::my_interaction_fast::PingError>>;
fn truthify(
&self,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<::futures::stream::BoxStream<'static, ::std::result::Result<::std::primitive::bool, crate::errors::my_interaction_fast::TruthifyStreamError>>, crate::errors::my_interaction_fast::TruthifyError>>;
}
pub trait MyInteractionFastExt for self::Args_MyInteractionFast_frobnicate<'a> {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "MyInteractionFast.frobnicate"))]
fn write(&self, p: &mut P) {
p.write_struct_begin("args");
p.write_field_stop();
p.write_struct_end();
}
}
struct Args_MyInteractionFast_ping<'a> {
_phantom: ::std::marker::PhantomData<&'a ()>,
}
impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize for self::Args_MyInteractionFast_ping<'a> {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "MyInteractionFast.ping"))]
fn write(&self, p: &mut P) {
p.write_struct_begin("args");
p.write_field_stop();
p.write_struct_end();
}
}
struct Args_MyInteractionFast_truthify<'a> {
_phantom: ::std::marker::PhantomData<&'a ()>,
}
impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize for self::Args_MyInteractionFast_truthify<'a> {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "MyInteractionFast.truthify"))]
fn write(&self, p: &mut P) {
p.write_struct_begin("args");
p.write_field_stop();
p.write_struct_end();
}
}
impl MyInteractionFast for MyInteractionFastImpl
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Frame: ::fbthrift::Framing : ::fbthrift::BufMutExt MyInteractionFastExt
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 MyInteractionFastDynClient = (protocol: P, transport: T, spawner: S) -> ::std::sync::Arc {
transport: T,
_phantom: ::std::marker::PhantomData SerialInteractionImpl
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Frame: ::fbthrift::Framing : ::fbthrift::BufMutExt ("SerialInteraction.frobnicate", &args) {
::std::result::Result::Ok(res) => res,
::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(),
};
let call = transport
.call(SERVICE_NAME.as_cstr(), SERVICE_METHOD_NAME.as_cstr(), request_env, rpc_options)
.instrument(::tracing::trace_span!("call", method = "SerialInteraction.frobnicate"));
async move {
let reply_env = call.await?;
let de = P::deserializer(reply_env);
let res = ::fbthrift::help::async_deserialize_response_envelope:: (de).await?;
let res = match res {
::std::result::Result::Ok(res) => res,
::std::result::Result::Err(aexn) => {
::std::result::Result::Err(crate::errors::serial_interaction::FrobnicateError::ApplicationException(aexn))
}
};
res
}
.instrument(::tracing::info_span!("stream", method = "SerialInteraction.frobnicate"))
.boxed()
}
}
pub trait SerialInteraction: ::std::marker::Send {
fn frobnicate(
&self,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::serial_interaction::FrobnicateError>>;
}
pub trait SerialInteractionExt for self::Args_SerialInteraction_frobnicate<'a> {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "SerialInteraction.frobnicate"))]
fn write(&self, p: &mut P) {
p.write_struct_begin("args");
p.write_field_stop();
p.write_struct_end();
}
}
impl SerialInteraction for SerialInteractionImpl
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Frame: ::fbthrift::Framing : ::fbthrift::BufMutExt SerialInteractionExt
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 SerialInteractionDynClient = (protocol: P, transport: T, spawner: S) -> ::std::sync::Arc {
transport: T,
_phantom: ::std::marker::PhantomData MyServiceImpl
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Frame: ::fbthrift::Framing : ::fbthrift::BufMutExt ("foo", &args) {
::std::result::Result::Ok(res) => res,
::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(),
};
let call = transport
.call(SERVICE_NAME.as_cstr(), SERVICE_METHOD_NAME.as_cstr(), request_env, rpc_options)
.instrument(::tracing::trace_span!("call", method = "MyService.foo"));
async move {
let reply_env = call.await?;
let de = P::deserializer(reply_env);
let res = ::fbthrift::help::async_deserialize_response_envelope:: (de).await?;
let res = match res {
::std::result::Result::Ok(res) => res,
::std::result::Result::Err(aexn) => {
::std::result::Result::Err(crate::errors::my_service::FooError::ApplicationException(aexn))
}
};
res
}
.instrument(::tracing::info_span!("stream", method = "MyService.foo"))
.boxed()
}
fn _interact_impl(
&self,
arg_arg: ::std::primitive::i32,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result ::new(interaction_transport);
let transport = interaction_impl.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:: ("interact", &args) {
::std::result::Result::Ok(res) => res,
::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(),
};
let call = transport
.call(SERVICE_NAME.as_cstr(), SERVICE_METHOD_NAME.as_cstr(), request_env, rpc_options)
.instrument(::tracing::trace_span!("call", method = "MyService.interact"));
async move {
let reply_env = call.await?;
let de = P::deserializer(reply_env);
let res = ::fbthrift::help::async_deserialize_response_envelope:: (de).await?;
let res = match res {
::std::result::Result::Ok(res) => res,
::std::result::Result::Err(aexn) => {
::std::result::Result::Err(crate::errors::my_service::InteractError::ApplicationException(aexn))
}
};
let interaction_client: crate::client::MyInteractionClient = ::std::sync::Arc::new(interaction_impl);
res?;
::std::result::Result::Ok(interaction_client)
}
.instrument(::tracing::info_span!("stream", method = "MyService.interact"))
.boxed()
}
fn _interactFast_impl(
&self,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(crate::client::MyInteractionFastClient, ::std::primitive::i32), crate::errors::my_service::InteractFastError>> {
use ::const_cstr::const_cstr;
use ::tracing::Instrument as _;
use ::futures::FutureExt as _;
const_cstr! {
SERVICE_NAME = "MyService";
SERVICE_METHOD_NAME = "MyService.interactFast";
INTERACTION_NAME = "MyInteractionFast";
}
let args = self::Args_MyService_interactFast {
_phantom: ::std::marker::PhantomData,
};
let interaction_transport = match self.transport().create_interaction(INTERACTION_NAME.as_cstr()) {
::std::result::Result::Ok(res) => res,
::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(),
};
let interaction_impl = MyInteractionFastImpl:: ::new(interaction_transport);
let transport = interaction_impl.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:: ("interactFast", &args) {
::std::result::Result::Ok(res) => res,
::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(),
};
let call = transport
.call(SERVICE_NAME.as_cstr(), SERVICE_METHOD_NAME.as_cstr(), request_env, rpc_options)
.instrument(::tracing::trace_span!("call", method = "MyService.interactFast"));
async move {
let reply_env = call.await?;
let de = P::deserializer(reply_env);
let res = ::fbthrift::help::async_deserialize_response_envelope:: (de).await?;
let res = match res {
::std::result::Result::Ok(res) => res,
::std::result::Result::Err(aexn) => {
::std::result::Result::Err(crate::errors::my_service::InteractFastError::ApplicationException(aexn))
}
};
let interaction_client: crate::client::MyInteractionFastClient = ::std::sync::Arc::new(interaction_impl);
::std::result::Result::Ok((interaction_client, res?))
}
.instrument(::tracing::info_span!("stream", method = "MyService.interactFast"))
.boxed()
}
fn _serialize_impl(
&self,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(crate::client::SerialInteractionClient, (::std::primitive::i32, ::futures::stream::BoxStream<'static, ::std::result::Result<::std::primitive::i32, crate::errors::my_service::SerializeStreamError>>)), crate::errors::my_service::SerializeError>> {
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 = "MyService";
SERVICE_METHOD_NAME = "MyService.serialize";
INTERACTION_NAME = "SerialInteraction";
}
let args = self::Args_MyService_serialize {
_phantom: ::std::marker::PhantomData,
};
let interaction_transport = match self.transport().create_interaction(INTERACTION_NAME.as_cstr()) {
::std::result::Result::Ok(res) => res,
::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(),
};
let interaction_impl = SerialInteractionImpl:: ::new(interaction_transport);
let transport = interaction_impl.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:: ("serialize", &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 = "MyService.serialize"));
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::my_service::SerializeStreamError::from(err)),
::std::result::Result::Ok(item_enc) => {
S::spawn(move || {
match item_enc {
::fbthrift::ClientStreamElement::Reply(payload) => {
let mut de = P::deserializer(payload);
(de)
.await??
.map(move |initial| (initial, new_stream));
let interaction_client: crate::client::SerialInteractionClient = ::std::sync::Arc::new(interaction_impl);
::std::result::Result::Ok((interaction_client, res?))
}
.instrument(::tracing::info_span!("stream", method = "MyService.serialize"))
.boxed()
}
}
pub trait MyService: ::std::marker::Send {
fn createMyInteraction(
&self,
) -> ::std::result::Result for self::Args_MyService_foo<'a> {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "MyService.foo"))]
fn write(&self, p: &mut P) {
p.write_struct_begin("args");
p.write_field_stop();
p.write_struct_end();
}
}
struct Args_MyService_interact<'a> {
arg: ::std::primitive::i32,
_phantom: ::std::marker::PhantomData<&'a ()>,
}
impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize for self::Args_MyService_interact<'a> {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "MyService.interact"))]
fn write(&self, p: &mut P) {
p.write_struct_begin("args");
p.write_field_begin("arg", ::fbthrift::TType::I32, 1i16);
::fbthrift::Serialize::write(&self.arg, p);
p.write_field_end();
p.write_field_stop();
p.write_struct_end();
}
}
struct Args_MyService_interactFast<'a> {
_phantom: ::std::marker::PhantomData<&'a ()>,
}
impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize for self::Args_MyService_interactFast<'a> {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "MyService.interactFast"))]
fn write(&self, p: &mut P) {
p.write_struct_begin("args");
p.write_field_stop();
p.write_struct_end();
}
}
struct Args_MyService_serialize<'a> {
_phantom: ::std::marker::PhantomData<&'a ()>,
}
impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize for self::Args_MyService_serialize<'a> {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "MyService.serialize"))]
fn write(&self, p: &mut P) {
p.write_struct_begin("args");
p.write_field_stop();
p.write_struct_end();
}
}
impl MyService for MyServiceImpl
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Frame: ::fbthrift::Framing : ::fbthrift::BufMutExt ::new(
self.transport().create_interaction(INTERACTION_NAME.as_cstr())?
)
)
)
}
fn createMyInteractionFast(
&self,
) -> ::std::result::Result ::new(
self.transport().create_interaction(INTERACTION_NAME.as_cstr())?
)
)
)
}
fn createSerialInteraction(
&self,
) -> ::std::result::Result ::new(
self.transport().create_interaction(INTERACTION_NAME.as_cstr())?
)
)
)
}
fn foo(
&self,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::my_service::FooError>> {
let rpc_options = T::RpcOptions::default();
self._foo_impl(
rpc_options,
)
}
fn interact(
&self,
arg_arg: ::std::primitive::i32,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result MyServiceExt
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 MyServiceDynClient = (protocol: P, transport: T, spawner: S) -> ::std::sync::Arc MyInteractionExt MyInteractionFastExt SerialInteractionExt MyServiceExt