// @generated by Thrift for thrift/compiler/test/fixtures/adapter/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::service; #[doc(inline)] #[allow(ambiguous_glob_reexports)] pub use ::::errors::service::*; #[doc(inline)] pub use ::::errors::adapter_service; #[doc(inline)] #[allow(ambiguous_glob_reexports)] pub use ::::errors::adapter_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 `Service`. pub struct ServiceImpl { transport: T, _phantom: ::std::marker::PhantomData (P, S)>, } impl ServiceImpl 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 _func_impl( &self, arg_arg1: &::std::primitive::str, arg_arg2: &::std::primitive::str, arg_arg3: &crate::types::Foo, rpc_options: T::RpcOptions, ) -> ::futures::future::BoxFuture<'static, ::std::result::Result> { use ::const_cstr::const_cstr; use ::tracing::Instrument as _; use ::futures::FutureExt as _; const_cstr! { SERVICE_NAME = "Service"; SERVICE_METHOD_NAME = "Service.func"; } let args = self::Args_Service_func { arg1: arg_arg1, arg2: arg_arg2, arg3: arg_arg3, _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::("func", &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 = "Service.func")); 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::service::FuncError::ApplicationException(aexn)) } }; res } .instrument(::tracing::info_span!("stream", method = "Service.func")) .boxed() } } pub trait Service: ::std::marker::Send { fn func( &self, arg_arg1: &::std::primitive::str, arg_arg2: &::std::primitive::str, arg_arg3: &crate::types::Foo, ) -> ::futures::future::BoxFuture<'static, ::std::result::Result>; } pub trait ServiceExt: Service where T: ::fbthrift::Transport, { fn func_with_rpc_opts( &self, arg_arg1: &::std::primitive::str, arg_arg2: &::std::primitive::str, arg_arg3: &crate::types::Foo, rpc_options: T::RpcOptions, ) -> ::futures::future::BoxFuture<'static, ::std::result::Result>; fn transport(&self) -> &T; } struct Args_Service_func<'a> { arg1: &'a ::std::primitive::str, arg2: &'a ::std::primitive::str, arg3: &'a crate::types::Foo, _phantom: ::std::marker::PhantomData<&'a ()>, } impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize

for self::Args_Service_func<'a> { #[inline] #[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "Service.func"))] fn write(&self, p: &mut P) { p.write_struct_begin("args"); p.write_field_begin("arg1", ::fbthrift::TType::String, 1i16); ::fbthrift::Serialize::write(&::to_thrift_field::(&self.arg1, 1), p); p.write_field_end(); p.write_field_begin("arg2", ::fbthrift::TType::String, 2i16); ::fbthrift::Serialize::write(&self.arg2, p); p.write_field_end(); p.write_field_begin("arg3", ::fbthrift::TType::Struct, 3i16); ::fbthrift::Serialize::write(&self.arg3, p); p.write_field_end(); p.write_field_stop(); p.write_struct_end(); } } impl Service for ServiceImpl 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 func( &self, arg_arg1: &::std::primitive::str, arg_arg2: &::std::primitive::str, arg_arg3: &crate::types::Foo, ) -> ::futures::future::BoxFuture<'static, ::std::result::Result> { let rpc_options = T::RpcOptions::default(); self._func_impl( arg_arg1, arg_arg2, arg_arg3, rpc_options, ) } } impl ServiceExt for ServiceImpl 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 func_with_rpc_opts( &self, arg_arg1: &::std::primitive::str, arg_arg2: &::std::primitive::str, arg_arg3: &crate::types::Foo, rpc_options: T::RpcOptions, ) -> ::futures::future::BoxFuture<'static, ::std::result::Result> { self._func_impl( arg_arg1, arg_arg2, arg_arg3, rpc_options, ) } fn transport(&self) -> &T { self.transport() } } #[allow(deprecated)] impl<'a, S> Service for S where S: ::std::convert::AsRef, S: ::std::marker::Send, { fn func( &self, arg_arg1: &::std::primitive::str, arg_arg2: &::std::primitive::str, arg_arg3: &crate::types::Foo, ) -> ::futures::future::BoxFuture<'static, ::std::result::Result> { self.as_ref().func( arg_arg1, arg_arg2, arg_arg3, ) } } #[allow(deprecated)] impl ServiceExt for S where S: ::std::convert::AsRef, S: ::std::convert::AsRef + 'static>, S: ::std::marker::Send, T: ::fbthrift::Transport, { fn func_with_rpc_opts( &self, arg_arg1: &::std::primitive::str, arg_arg2: &::std::primitive::str, arg_arg3: &crate::types::Foo, rpc_options: T::RpcOptions, ) -> ::futures::future::BoxFuture<'static, ::std::result::Result> { >>::as_ref(self).func_with_rpc_opts( arg_arg1, arg_arg2, arg_arg3, rpc_options, ) } fn transport(&self) -> &T { as ServiceExt>::transport(>>::as_ref(self)) } } #[derive(Clone)] pub struct make_Service; /// 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 Service { 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(ServiceImpl::::new(transport)) } } impl dyn ServiceExt 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(ServiceImpl::::new(transport)) } } pub type ServiceDynClient = ::Api; pub type ServiceClient = ::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_Service { type Api = dyn Service + ::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 `AdapterService`. pub struct AdapterServiceImpl { transport: T, _phantom: ::std::marker::PhantomData (P, S)>, } impl AdapterServiceImpl 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 _count_impl( &self, rpc_options: T::RpcOptions, ) -> ::futures::future::BoxFuture<'static, ::std::result::Result> { use ::const_cstr::const_cstr; use ::tracing::Instrument as _; use ::futures::FutureExt as _; const_cstr! { SERVICE_NAME = "AdapterService"; SERVICE_METHOD_NAME = "AdapterService.count"; } let args = self::Args_AdapterService_count { _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::("count", &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 = "AdapterService.count")); 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::adapter_service::CountError::ApplicationException(aexn)) } }; res } .instrument(::tracing::info_span!("stream", method = "AdapterService.count")) .boxed() } fn _adaptedTypes_impl( &self, arg_arg: &crate::types::HeapAllocated, rpc_options: T::RpcOptions, ) -> ::futures::future::BoxFuture<'static, ::std::result::Result> { use ::const_cstr::const_cstr; use ::tracing::Instrument as _; use ::futures::FutureExt as _; const_cstr! { SERVICE_NAME = "AdapterService"; SERVICE_METHOD_NAME = "AdapterService.adaptedTypes"; } let args = self::Args_AdapterService_adaptedTypes { arg: arg_arg, _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::("adaptedTypes", &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 = "AdapterService.adaptedTypes")); 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::adapter_service::AdaptedTypesError::ApplicationException(aexn)) } }; res } .instrument(::tracing::info_span!("stream", method = "AdapterService.adaptedTypes")) .boxed() } } pub trait AdapterService: ::std::marker::Send { fn count( &self, ) -> ::futures::future::BoxFuture<'static, ::std::result::Result>; fn adaptedTypes( &self, arg_arg: &crate::types::HeapAllocated, ) -> ::futures::future::BoxFuture<'static, ::std::result::Result>; } pub trait AdapterServiceExt: AdapterService where T: ::fbthrift::Transport, { fn count_with_rpc_opts( &self, rpc_options: T::RpcOptions, ) -> ::futures::future::BoxFuture<'static, ::std::result::Result>; fn adaptedTypes_with_rpc_opts( &self, arg_arg: &crate::types::HeapAllocated, rpc_options: T::RpcOptions, ) -> ::futures::future::BoxFuture<'static, ::std::result::Result>; fn transport(&self) -> &T; } struct Args_AdapterService_count<'a> { _phantom: ::std::marker::PhantomData<&'a ()>, } impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize

for self::Args_AdapterService_count<'a> { #[inline] #[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "AdapterService.count"))] fn write(&self, p: &mut P) { p.write_struct_begin("args"); p.write_field_stop(); p.write_struct_end(); } } struct Args_AdapterService_adaptedTypes<'a> { arg: &'a crate::types::HeapAllocated, _phantom: ::std::marker::PhantomData<&'a ()>, } impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize

for self::Args_AdapterService_adaptedTypes<'a> { #[inline] #[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "AdapterService.adaptedTypes"))] fn write(&self, p: &mut P) { p.write_struct_begin("args"); p.write_field_begin("arg", ::fbthrift::TType::Struct, 1i16); ::fbthrift::Serialize::write(&self.arg, p); p.write_field_end(); p.write_field_stop(); p.write_struct_end(); } } impl AdapterService for AdapterServiceImpl 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 count( &self, ) -> ::futures::future::BoxFuture<'static, ::std::result::Result> { let rpc_options = T::RpcOptions::default(); self._count_impl( rpc_options, ) } fn adaptedTypes( &self, arg_arg: &crate::types::HeapAllocated, ) -> ::futures::future::BoxFuture<'static, ::std::result::Result> { let rpc_options = T::RpcOptions::default(); self._adaptedTypes_impl( arg_arg, rpc_options, ) } } impl AdapterServiceExt for AdapterServiceImpl 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 count_with_rpc_opts( &self, rpc_options: T::RpcOptions, ) -> ::futures::future::BoxFuture<'static, ::std::result::Result> { self._count_impl( rpc_options, ) } fn adaptedTypes_with_rpc_opts( &self, arg_arg: &crate::types::HeapAllocated, rpc_options: T::RpcOptions, ) -> ::futures::future::BoxFuture<'static, ::std::result::Result> { self._adaptedTypes_impl( arg_arg, rpc_options, ) } fn transport(&self) -> &T { self.transport() } } #[allow(deprecated)] impl<'a, S> AdapterService for S where S: ::std::convert::AsRef, S: ::std::marker::Send, { fn count( &self, ) -> ::futures::future::BoxFuture<'static, ::std::result::Result> { self.as_ref().count( ) } fn adaptedTypes( &self, arg_arg: &crate::types::HeapAllocated, ) -> ::futures::future::BoxFuture<'static, ::std::result::Result> { self.as_ref().adaptedTypes( arg_arg, ) } } #[allow(deprecated)] impl AdapterServiceExt for S where S: ::std::convert::AsRef, S: ::std::convert::AsRef + 'static>, S: ::std::marker::Send, T: ::fbthrift::Transport, { fn count_with_rpc_opts( &self, rpc_options: T::RpcOptions, ) -> ::futures::future::BoxFuture<'static, ::std::result::Result> { >>::as_ref(self).count_with_rpc_opts( rpc_options, ) } fn adaptedTypes_with_rpc_opts( &self, arg_arg: &crate::types::HeapAllocated, rpc_options: T::RpcOptions, ) -> ::futures::future::BoxFuture<'static, ::std::result::Result> { >>::as_ref(self).adaptedTypes_with_rpc_opts( arg_arg, rpc_options, ) } fn transport(&self) -> &T { as AdapterServiceExt>::transport(>>::as_ref(self)) } } #[derive(Clone)] pub struct make_AdapterService; /// 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 AdapterService { 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(AdapterServiceImpl::::new(transport)) } } impl dyn AdapterServiceExt 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(AdapterServiceImpl::::new(transport)) } } pub type AdapterServiceDynClient = ::Api; pub type AdapterServiceClient = ::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_AdapterService { type Api = dyn AdapterService + ::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) } }