// @generated by Thrift for thrift/compiler/test/fixtures/inheritance/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_root;
#[doc(inline)]
#[allow(ambiguous_glob_reexports)]
pub use ::::errors::my_root::*;
#[doc(inline)]
pub use ::::errors::my_node;
#[doc(inline)]
#[allow(ambiguous_glob_reexports)]
pub use ::::errors::my_node::*;
#[doc(inline)]
pub use ::::errors::my_leaf;
#[doc(inline)]
#[allow(ambiguous_glob_reexports)]
pub use ::::errors::my_leaf::*;
}
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 `MyRoot`.
pub struct MyRootImpl
{
transport: T,
_phantom: ::std::marker::PhantomData (P, S)>,
}
impl MyRootImpl
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Frame: ::fbthrift::Framing>,
::fbthrift::ProtocolEncoded: ::fbthrift::BufMutExt>,
P::Deserializer: ::std::marker::Send,
S: ::fbthrift::help::Spawner,
{
pub fn new(
transport: T,
) -> Self {
Self {
transport,
_phantom: ::std::marker::PhantomData,
}
}
pub fn transport(&self) -> &T {
&self.transport
}
fn _do_root_impl(
&self,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::my_root::DoRootError>> {
use ::const_cstr::const_cstr;
use ::tracing::Instrument as _;
use ::futures::FutureExt as _;
const_cstr! {
SERVICE_NAME = "MyRoot";
SERVICE_METHOD_NAME = "MyRoot.do_root";
}
let args = self::Args_MyRoot_do_root {
_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::("do_root", &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 = "MyRoot.do_root"));
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_root::DoRootError::ApplicationException(aexn))
}
};
res
}
.instrument(::tracing::info_span!("stream", method = "MyRoot.do_root"))
.boxed()
}
}
pub trait MyRoot: ::std::marker::Send {
fn do_root(
&self,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::my_root::DoRootError>>;
}
pub trait MyRootExt: MyRoot
where
T: ::fbthrift::Transport,
{
fn do_root_with_rpc_opts(
&self,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::my_root::DoRootError>>;
fn transport(&self) -> &T;
}
struct Args_MyRoot_do_root<'a> {
_phantom: ::std::marker::PhantomData<&'a ()>,
}
impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize for self::Args_MyRoot_do_root<'a> {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "MyRoot.do_root"))]
fn write(&self, p: &mut P) {
p.write_struct_begin("args");
p.write_field_stop();
p.write_struct_end();
}
}
impl
MyRoot for MyRootImpl
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Frame: ::fbthrift::Framing>,
::fbthrift::ProtocolEncoded: ::fbthrift::BufMutExt>,
P::Deserializer: ::std::marker::Send,
S: ::fbthrift::help::Spawner,
{
fn do_root(
&self,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::my_root::DoRootError>> {
let rpc_options = T::RpcOptions::default();
self._do_root_impl(
rpc_options,
)
}
}
impl MyRootExt for MyRootImpl
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Frame: ::fbthrift::Framing>,
::fbthrift::ProtocolEncoded: ::fbthrift::BufMutExt>,
P::Deserializer: ::std::marker::Send,
S: ::fbthrift::help::Spawner,
{
fn do_root_with_rpc_opts(
&self,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::my_root::DoRootError>> {
self._do_root_impl(
rpc_options,
)
}
fn transport(&self) -> &T {
self.transport()
}
}
#[allow(deprecated)]
impl<'a, S> MyRoot for S
where
S: ::std::convert::AsRef,
S: ::std::marker::Send,
{
fn do_root(
&self,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::my_root::DoRootError>> {
self.as_ref().do_root(
)
}
}
#[allow(deprecated)]
impl MyRootExt for S
where
S: ::std::convert::AsRef,
S: ::std::convert::AsRef + 'static>,
S: ::std::marker::Send,
T: ::fbthrift::Transport,
{
fn do_root_with_rpc_opts(
&self,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::my_root::DoRootError>> {
>>::as_ref(self).do_root_with_rpc_opts(
rpc_options,
)
}
fn transport(&self) -> &T {
as MyRootExt>::transport(>>::as_ref(self))
}
}
#[derive(Clone)]
pub struct make_MyRoot;
/// To be called by user directly setting up a client. Avoids
/// needing ClientFactory trait in scope, avoids unidiomatic
/// make_Trait name.
///
/// ```
/// # const _: &str = stringify! {
/// use bgs::client::BuckGraphService;
///
/// let protocol = BinaryProtocol::new();
/// let transport = HttpClient::new();
/// let client = ::new(protocol, transport);
/// # };
/// ```
impl dyn MyRoot {
pub fn new(
protocol: P,
transport: T,
) -> ::std::sync::Arc
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Deserializer: ::std::marker::Send,
{
let spawner = ::fbthrift::help::NoopSpawner;
Self::with_spawner(protocol, transport, spawner)
}
pub fn with_spawner(
protocol: P,
transport: T,
spawner: S,
) -> ::std::sync::Arc
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Deserializer: ::std::marker::Send,
S: ::fbthrift::help::Spawner,
{
let _ = protocol;
let _ = spawner;
::std::sync::Arc::new(MyRootImpl::::new(transport))
}
}
impl dyn MyRootExt
where
T: ::fbthrift::Transport,
{
pub fn new(
protocol: P,
transport: T,
) -> ::std::sync::Arc + ::std::marker::Send + ::std::marker::Sync + 'static>
where
P: ::fbthrift::Protocol,
P::Deserializer: ::std::marker::Send,
{
let spawner = ::fbthrift::help::NoopSpawner;
Self::with_spawner(protocol, transport, spawner)
}
pub fn with_spawner(
protocol: P,
transport: T,
spawner: S,
) -> ::std::sync::Arc + ::std::marker::Send + ::std::marker::Sync + 'static>
where
P: ::fbthrift::Protocol,
P::Deserializer: ::std::marker::Send,
S: ::fbthrift::help::Spawner,
{
let _ = protocol;
let _ = spawner;
::std::sync::Arc::new(MyRootImpl::::new(transport))
}
}
pub type MyRootDynClient = ::Api;
pub type MyRootClient = ::std::sync::Arc;
/// The same thing, but to be called from generic contexts where we are
/// working with a type parameter `C: ClientFactory` to produce clients.
impl ::fbthrift::ClientFactory for make_MyRoot {
type Api = dyn MyRoot + ::std::marker::Send + ::std::marker::Sync + 'static;
fn with_spawner(protocol: P, transport: T, spawner: S) -> ::std::sync::Arc
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Deserializer: ::std::marker::Send,
S: ::fbthrift::help::Spawner,
{
::with_spawner(protocol, transport, spawner)
}
}
/// Client definitions for `MyNode`.
pub struct MyNodeImpl {
parent: crate::client::MyRootImpl
,
}
impl
MyNodeImpl
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Frame: ::fbthrift::Framing>,
::fbthrift::ProtocolEncoded: ::fbthrift::BufMutExt>,
P::Deserializer: ::std::marker::Send,
S: ::fbthrift::help::Spawner,
{
pub fn new(
transport: T,
) -> Self {
let parent = crate::client::MyRootImpl::::new(transport);
Self { parent }
}
pub fn transport(&self) -> &T {
self.parent.transport()
}
fn _do_mid_impl(
&self,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::my_node::DoMidError>> {
use ::const_cstr::const_cstr;
use ::tracing::Instrument as _;
use ::futures::FutureExt as _;
const_cstr! {
SERVICE_NAME = "MyNode";
SERVICE_METHOD_NAME = "MyNode.do_mid";
}
let args = self::Args_MyNode_do_mid {
_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::
("do_mid", &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 = "MyNode.do_mid"));
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_node::DoMidError::ApplicationException(aexn))
}
};
res
}
.instrument(::tracing::info_span!("stream", method = "MyNode.do_mid"))
.boxed()
}
}
#[allow(deprecated)]
impl
::std::convert::AsRef for MyNodeImpl
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Frame: ::fbthrift::Framing>,
::fbthrift::ProtocolEncoded: ::fbthrift::BufMutExt>,
P::Deserializer: ::std::marker::Send,
S: ::fbthrift::help::Spawner,
{
fn as_ref(&self) -> &(dyn crate::MyRoot + 'static)
{
&self.parent
}
}
#[allow(deprecated)]
impl ::std::convert::AsRef + 'static> for MyNodeImpl
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Frame: ::fbthrift::Framing>,
::fbthrift::ProtocolEncoded: ::fbthrift::BufMutExt>,
P::Deserializer: ::std::marker::Send,
S: ::fbthrift::help::Spawner,
{
fn as_ref(&self) -> &(dyn crate::MyRootExt + 'static)
{
&self.parent
}
}
pub trait MyNode: crate::client::MyRoot + ::std::marker::Send {
fn do_mid(
&self,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::my_node::DoMidError>>;
}
pub trait MyNodeExt: MyNode + crate::client::MyRootExt
where
T: ::fbthrift::Transport,
{
fn do_mid_with_rpc_opts(
&self,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::my_node::DoMidError>>;
fn transport(&self) -> &T;
}
struct Args_MyNode_do_mid<'a> {
_phantom: ::std::marker::PhantomData<&'a ()>,
}
impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize for self::Args_MyNode_do_mid<'a> {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "MyNode.do_mid"))]
fn write(&self, p: &mut P) {
p.write_struct_begin("args");
p.write_field_stop();
p.write_struct_end();
}
}
impl
MyNode for MyNodeImpl
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Frame: ::fbthrift::Framing>,
::fbthrift::ProtocolEncoded: ::fbthrift::BufMutExt>,
P::Deserializer: ::std::marker::Send,
S: ::fbthrift::help::Spawner,
{
fn do_mid(
&self,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::my_node::DoMidError>> {
let rpc_options = T::RpcOptions::default();
self._do_mid_impl(
rpc_options,
)
}
}
impl MyNodeExt for MyNodeImpl
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Frame: ::fbthrift::Framing>,
::fbthrift::ProtocolEncoded: ::fbthrift::BufMutExt>,
P::Deserializer: ::std::marker::Send,
S: ::fbthrift::help::Spawner,
{
fn do_mid_with_rpc_opts(
&self,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::my_node::DoMidError>> {
self._do_mid_impl(
rpc_options,
)
}
fn transport(&self) -> &T {
self.transport()
}
}
#[allow(deprecated)]
impl<'a, S> MyNode for S
where
S: ::std::convert::AsRef,
S: crate::MyRoot,
S: ::std::marker::Send,
{
fn do_mid(
&self,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::my_node::DoMidError>> {
self.as_ref().do_mid(
)
}
}
#[allow(deprecated)]
impl MyNodeExt for S
where
S: ::std::convert::AsRef,
S: ::std::convert::AsRef + 'static>,
S: crate::MyRoot,
S: crate::MyRootExt,
S: ::std::marker::Send,
T: ::fbthrift::Transport,
{
fn do_mid_with_rpc_opts(
&self,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::my_node::DoMidError>> {
>>::as_ref(self).do_mid_with_rpc_opts(
rpc_options,
)
}
fn transport(&self) -> &T {
as MyNodeExt>::transport(>>::as_ref(self))
}
}
#[derive(Clone)]
pub struct make_MyNode;
/// To be called by user directly setting up a client. Avoids
/// needing ClientFactory trait in scope, avoids unidiomatic
/// make_Trait name.
///
/// ```
/// # const _: &str = stringify! {
/// use bgs::client::BuckGraphService;
///
/// let protocol = BinaryProtocol::new();
/// let transport = HttpClient::new();
/// let client = ::new(protocol, transport);
/// # };
/// ```
impl dyn MyNode {
pub fn new(
protocol: P,
transport: T,
) -> ::std::sync::Arc
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Deserializer: ::std::marker::Send,
{
let spawner = ::fbthrift::help::NoopSpawner;
Self::with_spawner(protocol, transport, spawner)
}
pub fn with_spawner(
protocol: P,
transport: T,
spawner: S,
) -> ::std::sync::Arc
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Deserializer: ::std::marker::Send,
S: ::fbthrift::help::Spawner,
{
let _ = protocol;
let _ = spawner;
::std::sync::Arc::new(MyNodeImpl::::new(transport))
}
}
impl dyn MyNodeExt
where
T: ::fbthrift::Transport,
{
pub fn new(
protocol: P,
transport: T,
) -> ::std::sync::Arc + ::std::marker::Send + ::std::marker::Sync + 'static>
where
P: ::fbthrift::Protocol,
P::Deserializer: ::std::marker::Send,
{
let spawner = ::fbthrift::help::NoopSpawner;
Self::with_spawner(protocol, transport, spawner)
}
pub fn with_spawner(
protocol: P,
transport: T,
spawner: S,
) -> ::std::sync::Arc + ::std::marker::Send + ::std::marker::Sync + 'static>
where
P: ::fbthrift::Protocol,
P::Deserializer: ::std::marker::Send,
S: ::fbthrift::help::Spawner,
{
let _ = protocol;
let _ = spawner;
::std::sync::Arc::new(MyNodeImpl::::new(transport))
}
}
pub type MyNodeDynClient = ::Api;
pub type MyNodeClient = ::std::sync::Arc;
/// The same thing, but to be called from generic contexts where we are
/// working with a type parameter `C: ClientFactory` to produce clients.
impl ::fbthrift::ClientFactory for make_MyNode {
type Api = dyn MyNode + ::std::marker::Send + ::std::marker::Sync + 'static;
fn with_spawner(protocol: P, transport: T, spawner: S) -> ::std::sync::Arc
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Deserializer: ::std::marker::Send,
S: ::fbthrift::help::Spawner,
{
::with_spawner(protocol, transport, spawner)
}
}
/// Client definitions for `MyLeaf`.
pub struct MyLeafImpl {
parent: crate::client::MyNodeImpl
,
}
impl
MyLeafImpl
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Frame: ::fbthrift::Framing>,
::fbthrift::ProtocolEncoded: ::fbthrift::BufMutExt>,
P::Deserializer: ::std::marker::Send,
S: ::fbthrift::help::Spawner,
{
pub fn new(
transport: T,
) -> Self {
let parent = crate::client::MyNodeImpl::::new(transport);
Self { parent }
}
pub fn transport(&self) -> &T {
self.parent.transport()
}
fn _do_leaf_impl(
&self,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::my_leaf::DoLeafError>> {
use ::const_cstr::const_cstr;
use ::tracing::Instrument as _;
use ::futures::FutureExt as _;
const_cstr! {
SERVICE_NAME = "MyLeaf";
SERVICE_METHOD_NAME = "MyLeaf.do_leaf";
}
let args = self::Args_MyLeaf_do_leaf {
_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::
("do_leaf", &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 = "MyLeaf.do_leaf"));
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_leaf::DoLeafError::ApplicationException(aexn))
}
};
res
}
.instrument(::tracing::info_span!("stream", method = "MyLeaf.do_leaf"))
.boxed()
}
}
#[allow(deprecated)]
impl
::std::convert::AsRef for MyLeafImpl
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Frame: ::fbthrift::Framing>,
::fbthrift::ProtocolEncoded: ::fbthrift::BufMutExt>,
P::Deserializer: ::std::marker::Send,
S: ::fbthrift::help::Spawner,
{
fn as_ref(&self) -> &(dyn crate::MyNode + 'static)
{
&self.parent
}
}
#[allow(deprecated)]
impl ::std::convert::AsRef + 'static> for MyLeafImpl
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Frame: ::fbthrift::Framing>,
::fbthrift::ProtocolEncoded: ::fbthrift::BufMutExt>,
P::Deserializer: ::std::marker::Send,
S: ::fbthrift::help::Spawner,
{
fn as_ref(&self) -> &(dyn crate::MyNodeExt + 'static)
{
&self.parent
}
}
#[allow(deprecated)]
impl ::std::convert::AsRef for MyLeafImpl
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Frame: ::fbthrift::Framing>,
::fbthrift::ProtocolEncoded: ::fbthrift::BufMutExt>,
P::Deserializer: ::std::marker::Send,
S: ::fbthrift::help::Spawner,
{
fn as_ref(&self) -> &(dyn crate::MyRoot + 'static)
{
self.parent.as_ref()
}
}
#[allow(deprecated)]
impl ::std::convert::AsRef + 'static> for MyLeafImpl
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Frame: ::fbthrift::Framing>,
::fbthrift::ProtocolEncoded: ::fbthrift::BufMutExt>,
P::Deserializer: ::std::marker::Send,
S: ::fbthrift::help::Spawner,
{
fn as_ref(&self) -> &(dyn crate::MyRootExt + 'static)
{
self.parent.as_ref()
}
}
pub trait MyLeaf: crate::client::MyNode + ::std::marker::Send {
fn do_leaf(
&self,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::my_leaf::DoLeafError>>;
}
pub trait MyLeafExt: MyLeaf + crate::client::MyNodeExt
where
T: ::fbthrift::Transport,
{
fn do_leaf_with_rpc_opts(
&self,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::my_leaf::DoLeafError>>;
fn transport(&self) -> &T;
}
struct Args_MyLeaf_do_leaf<'a> {
_phantom: ::std::marker::PhantomData<&'a ()>,
}
impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize for self::Args_MyLeaf_do_leaf<'a> {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "MyLeaf.do_leaf"))]
fn write(&self, p: &mut P) {
p.write_struct_begin("args");
p.write_field_stop();
p.write_struct_end();
}
}
impl
MyLeaf for MyLeafImpl
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Frame: ::fbthrift::Framing>,
::fbthrift::ProtocolEncoded: ::fbthrift::BufMutExt>,
P::Deserializer: ::std::marker::Send,
S: ::fbthrift::help::Spawner,
{
fn do_leaf(
&self,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::my_leaf::DoLeafError>> {
let rpc_options = T::RpcOptions::default();
self._do_leaf_impl(
rpc_options,
)
}
}
impl MyLeafExt for MyLeafImpl
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Frame: ::fbthrift::Framing>,
::fbthrift::ProtocolEncoded: ::fbthrift::BufMutExt>,
P::Deserializer: ::std::marker::Send,
S: ::fbthrift::help::Spawner,
{
fn do_leaf_with_rpc_opts(
&self,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::my_leaf::DoLeafError>> {
self._do_leaf_impl(
rpc_options,
)
}
fn transport(&self) -> &T {
self.transport()
}
}
#[allow(deprecated)]
impl<'a, S> MyLeaf for S
where
S: ::std::convert::AsRef,
S: crate::MyNode,
S: crate::MyRoot,
S: ::std::marker::Send,
{
fn do_leaf(
&self,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::my_leaf::DoLeafError>> {
self.as_ref().do_leaf(
)
}
}
#[allow(deprecated)]
impl MyLeafExt for S
where
S: ::std::convert::AsRef,
S: ::std::convert::AsRef + 'static>,
S: crate::MyNode,
S: crate::MyNodeExt,
S: crate::MyRoot,
S: crate::MyRootExt,
S: ::std::marker::Send,
T: ::fbthrift::Transport,
{
fn do_leaf_with_rpc_opts(
&self,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::my_leaf::DoLeafError>> {
>>::as_ref(self).do_leaf_with_rpc_opts(
rpc_options,
)
}
fn transport(&self) -> &T {
as MyLeafExt>::transport(>>::as_ref(self))
}
}
#[derive(Clone)]
pub struct make_MyLeaf;
/// To be called by user directly setting up a client. Avoids
/// needing ClientFactory trait in scope, avoids unidiomatic
/// make_Trait name.
///
/// ```
/// # const _: &str = stringify! {
/// use bgs::client::BuckGraphService;
///
/// let protocol = BinaryProtocol::new();
/// let transport = HttpClient::new();
/// let client = ::new(protocol, transport);
/// # };
/// ```
impl dyn MyLeaf {
pub fn new(
protocol: P,
transport: T,
) -> ::std::sync::Arc
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Deserializer: ::std::marker::Send,
{
let spawner = ::fbthrift::help::NoopSpawner;
Self::with_spawner(protocol, transport, spawner)
}
pub fn with_spawner(
protocol: P,
transport: T,
spawner: S,
) -> ::std::sync::Arc
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Deserializer: ::std::marker::Send,
S: ::fbthrift::help::Spawner,
{
let _ = protocol;
let _ = spawner;
::std::sync::Arc::new(MyLeafImpl::::new(transport))
}
}
impl dyn MyLeafExt
where
T: ::fbthrift::Transport,
{
pub fn new(
protocol: P,
transport: T,
) -> ::std::sync::Arc + ::std::marker::Send + ::std::marker::Sync + 'static>
where
P: ::fbthrift::Protocol,
P::Deserializer: ::std::marker::Send,
{
let spawner = ::fbthrift::help::NoopSpawner;
Self::with_spawner(protocol, transport, spawner)
}
pub fn with_spawner(
protocol: P,
transport: T,
spawner: S,
) -> ::std::sync::Arc + ::std::marker::Send + ::std::marker::Sync + 'static>
where
P: ::fbthrift::Protocol,
P::Deserializer: ::std::marker::Send,
S: ::fbthrift::help::Spawner,
{
let _ = protocol;
let _ = spawner;
::std::sync::Arc::new(MyLeafImpl::::new(transport))
}
}
pub type MyLeafDynClient = ::Api;
pub type MyLeafClient = ::std::sync::Arc;
/// The same thing, but to be called from generic contexts where we are
/// working with a type parameter `C: ClientFactory` to produce clients.
impl ::fbthrift::ClientFactory for make_MyLeaf {
type Api = dyn MyLeaf + ::std::marker::Send + ::std::marker::Sync + 'static;
fn with_spawner(protocol: P, transport: T, spawner: S) -> ::std::sync::Arc
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Deserializer: ::std::marker::Send,
S: ::fbthrift::help::Spawner,
{
::with_spawner(protocol, transport, spawner)
}
}