// @generated by Thrift for thrift/compiler/test/fixtures/rust-raw-identifiers/src/mod.thrift // This file is probably not the place you want to edit! //! Client implementation for each service in `mod`. #![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::foo; #[doc(inline)] #[allow(ambiguous_glob_reexports)] pub use ::::errors::foo::*; } 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 `Foo`. pub struct FooImpl
{
transport: T,
_phantom: ::std::marker::PhantomData FooImpl
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Frame: ::fbthrift::Framing : ::fbthrift::BufMutExt ("return", &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 = "Foo.return"));
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::foo::ReturnError::ApplicationException(aexn))
}
};
res
}
.instrument(::tracing::info_span!("stream", method = "Foo.return"))
.boxed()
}
fn _super_impl(
&self,
arg_bar: &crate::types::ThereAreNoPascalCaseKeywords,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::foo::SuperError>> {
use ::const_cstr::const_cstr;
use ::tracing::Instrument as _;
use ::futures::FutureExt as _;
const_cstr! {
SERVICE_NAME = "Foo";
SERVICE_METHOD_NAME = "Foo.super";
}
let args = self::Args_Foo_super {
bar: arg_bar,
_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:: ("super", &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 = "Foo.super"));
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::foo::SuperError::ApplicationException(aexn))
}
};
res
}
.instrument(::tracing::info_span!("stream", method = "Foo.super"))
.boxed()
}
}
pub trait Foo: ::std::marker::Send {
fn r#return(
&self,
arg_bar: &crate::types::ThereAreNoPascalCaseKeywords,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::foo::ReturnError>>;
fn super_(
&self,
arg_bar: &crate::types::ThereAreNoPascalCaseKeywords,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::foo::SuperError>>;
}
pub trait FooExt for self::Args_Foo_return<'a> {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "Foo.return"))]
fn write(&self, p: &mut P) {
p.write_struct_begin("args");
p.write_field_begin("bar", ::fbthrift::TType::Struct, 1i16);
::fbthrift::Serialize::write(&self.bar, p);
p.write_field_end();
p.write_field_stop();
p.write_struct_end();
}
}
struct Args_Foo_super<'a> {
bar: &'a crate::types::ThereAreNoPascalCaseKeywords,
_phantom: ::std::marker::PhantomData<&'a ()>,
}
impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize for self::Args_Foo_super<'a> {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "Foo.super"))]
fn write(&self, p: &mut P) {
p.write_struct_begin("args");
p.write_field_begin("bar", ::fbthrift::TType::Struct, 1i16);
::fbthrift::Serialize::write(&self.bar, p);
p.write_field_end();
p.write_field_stop();
p.write_struct_end();
}
}
impl Foo for FooImpl
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Frame: ::fbthrift::Framing : ::fbthrift::BufMutExt FooExt
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 FooDynClient = (protocol: P, transport: T, spawner: S) -> ::std::sync::Arc FooExt