// @generated by Thrift for thrift/compiler/test/fixtures/basic/src/module.thrift // This file is probably not the place you want to edit! //! Server definitions for `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 ::::services::foo_service; #[doc(inline)] #[allow(ambiguous_glob_reexports)] pub use ::::services::foo_service::*; #[doc(inline)] pub use ::::services::f_b303_service; #[doc(inline)] #[allow(ambiguous_glob_reexports)] pub use ::::services::f_b303_service::*; #[doc(inline)] pub use ::::services::my_service; #[doc(inline)] #[allow(ambiguous_glob_reexports)] pub use ::::services::my_service::*; #[doc(inline)] pub use ::::services::db_mixed_stack_arguments; #[doc(inline)] #[allow(ambiguous_glob_reexports)] pub use ::::services::db_mixed_stack_arguments::*; } pub(crate) use crate as server; pub(crate) use ::::services; #[::async_trait::async_trait] pub trait FooService: ::std::marker::Send + ::std::marker::Sync + 'static { async fn simple_rpc( &self, ) -> ::std::result::Result<(), crate::services::foo_service::SimpleRpcExn> { ::std::result::Result::Err(crate::services::foo_service::SimpleRpcExn::ApplicationException( ::fbthrift::ApplicationException::unimplemented_method( "FooService", "simple_rpc", ), )) } } #[::async_trait::async_trait] impl FooService for ::std::boxed::Box where T: FooService + Send + Sync + ?Sized, { async fn simple_rpc( &self, ) -> ::std::result::Result<(), crate::services::foo_service::SimpleRpcExn> { (**self).simple_rpc( ).await } } #[::async_trait::async_trait] impl FooService for ::std::sync::Arc where T: FooService + Send + Sync + ?Sized, { async fn simple_rpc( &self, ) -> ::std::result::Result<(), crate::services::foo_service::SimpleRpcExn> { (**self).simple_rpc( ).await } } /// Processor for FooService's methods. #[derive(Clone, Debug)] pub struct FooServiceProcessor { service: H, supa: ::fbthrift::NullServiceProcessor, _phantom: ::std::marker::PhantomData<(P, H, R, RS)>, } struct Args_FooService_simple_rpc { } impl ::fbthrift::Deserialize

for self::Args_FooService_simple_rpc { #[inline] #[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "FooService.simple_rpc"))] fn read(p: &mut P) -> ::anyhow::Result { static ARGS: &[::fbthrift::Field] = &[ ]; let _ = p.read_struct_begin(|_| ())?; loop { let (_, fty, fid) = p.read_field_begin(|_| (), ARGS)?; match (fty, fid as ::std::primitive::i32) { (::fbthrift::TType::Stop, _) => break, (fty, _) => p.skip(fty)?, } p.read_field_end()?; } p.read_struct_end()?; ::std::result::Result::Ok(Self { }) } } impl FooServiceProcessor where P: ::fbthrift::Protocol + ::std::marker::Send + ::std::marker::Sync + 'static, P::Frame: ::std::marker::Send + 'static, P::Deserializer: ::std::marker::Send, H: FooService, R: ::fbthrift::RequestContext + ::std::marker::Send + ::std::marker::Sync + 'static, RS: ::fbthrift::ReplyState + ::std::marker::Send + ::std::marker::Sync + 'static, ::ContextStack: ::fbthrift::ContextStack::Frame> + ::std::marker::Send + ::std::marker::Sync, ::fbthrift::ProtocolDecoded

: ::std::clone::Clone, ::fbthrift::ProtocolEncodedFinal

: ::std::clone::Clone + ::fbthrift::BufExt, { pub fn new(service: H) -> Self { Self { service, supa: ::fbthrift::NullServiceProcessor::new(), _phantom: ::std::marker::PhantomData, } } pub fn into_inner(self) -> H { self.service } #[::tracing::instrument(skip_all, name = "handler", fields(method = "FooService.simple_rpc"))] async fn handle_simple_rpc<'a>( &'a self, p: &'a mut P::Deserializer, req: ::fbthrift::ProtocolDecoded

, req_ctxt: &R, reply_state: ::std::sync::Arc, _seqid: ::std::primitive::u32, ) -> ::anyhow::Result<()> { use ::futures::FutureExt as _; const SERVICE_NAME: &::std::ffi::CStr = c"FooService"; const METHOD_NAME: &::std::ffi::CStr = c"simple_rpc"; const SERVICE_METHOD_NAME: &::std::ffi::CStr = c"FooService.simple_rpc"; let mut ctx_stack = req_ctxt.get_context_stack(SERVICE_NAME, SERVICE_METHOD_NAME)?; ::fbthrift::ContextStack::pre_read(&mut ctx_stack)?; let _args: self::Args_FooService_simple_rpc = ::fbthrift::Deserialize::read(p)?; let bytes_read = ::fbthrift::help::buf_len(&req)?; ::fbthrift::ContextStack::on_read_data(&mut ctx_stack, ::fbthrift::SerializedMessage { protocol: P::PROTOCOL_ID, method_name: METHOD_NAME, buffer: req, })?; ::fbthrift::ContextStack::post_read(&mut ctx_stack, bytes_read)?; let res = ::std::panic::AssertUnwindSafe( self.service.simple_rpc( ) ) .catch_unwind() .await; // nested results - panic catch on the outside, method on the inside let res = match res { ::std::result::Result::Ok(::std::result::Result::Ok(res)) => { ::tracing::trace!(method = "FooService.simple_rpc", "success"); ::std::result::Result::Ok(res) } ::std::result::Result::Ok(::std::result::Result::Err(exn)) => { ::tracing::error!(method = "FooService.simple_rpc", exception = ?exn); ::std::result::Result::Err(exn) } ::std::result::Result::Err(exn) => { let aexn = ::fbthrift::ApplicationException::handler_panic("FooService.simple_rpc", exn); ::tracing::error!(method = "FooService.simple_rpc", panic = ?aexn); ::std::result::Result::Err(crate::services::foo_service::SimpleRpcExn::ApplicationException(aexn)) } }; let env = ::fbthrift::help::serialize_result_envelope::( "simple_rpc", METHOD_NAME, _seqid, req_ctxt, &mut ctx_stack, res, )?; reply_state.send_reply(env); ::std::result::Result::Ok(()) } } #[::async_trait::async_trait] impl ::fbthrift::ServiceProcessor

for FooServiceProcessor where P: ::fbthrift::Protocol + ::std::marker::Send + ::std::marker::Sync + 'static, P::Deserializer: ::std::marker::Send, H: FooService, P::Frame: ::std::marker::Send + 'static, R: ::fbthrift::RequestContext + ::std::marker::Send + ::std::marker::Sync + 'static, ::ContextStack: ::fbthrift::ContextStack::Frame> + ::std::marker::Send + ::std::marker::Sync + 'static, RS: ::fbthrift::ReplyState + ::std::marker::Send + ::std::marker::Sync + 'static, ::fbthrift::ProtocolDecoded

: ::std::clone::Clone, ::fbthrift::ProtocolEncodedFinal

: ::std::clone::Clone + ::fbthrift::BufExt, { type RequestContext = R; type ReplyState = RS; #[inline] fn method_idx(&self, name: &[::std::primitive::u8]) -> ::std::result::Result<::std::primitive::usize, ::fbthrift::ApplicationException> { match name { b"simple_rpc" => ::std::result::Result::Ok(0usize), _ => ::std::result::Result::Err(::fbthrift::ApplicationException::unknown_method()), } } #[allow(clippy::match_single_binding)] async fn handle_method( &self, idx: ::std::primitive::usize, _p: &mut P::Deserializer, _req: ::fbthrift::ProtocolDecoded

, _req_ctxt: &R, _reply_state: ::std::sync::Arc, _seqid: ::std::primitive::u32, ) -> ::anyhow::Result<()> { match idx { 0usize => { self.handle_simple_rpc(_p, _req, _req_ctxt, _reply_state, _seqid).await } bad => panic!( "{}: unexpected method idx {}", "FooServiceProcessor", bad ), } } #[allow(clippy::match_single_binding)] #[inline] fn create_interaction_idx(&self, name: &::std::primitive::str) -> ::anyhow::Result<::std::primitive::usize> { match name { _ => ::anyhow::bail!("Unknown interaction"), } } #[allow(clippy::match_single_binding)] fn handle_create_interaction( &self, idx: ::std::primitive::usize, ) -> ::anyhow::Result< ::std::sync::Arc + ::std::marker::Send + 'static> > { match idx { bad => panic!( "{}: unexpected method idx {}", "FooServiceProcessor", bad ), } } async fn handle_on_termination(&self) { } } #[::async_trait::async_trait] impl ::fbthrift::ThriftService for FooServiceProcessor where P: ::fbthrift::Protocol + ::std::marker::Send + ::std::marker::Sync + 'static, P::Deserializer: ::std::marker::Send, P::Frame: ::std::marker::Send + 'static, H: FooService, R: ::fbthrift::RequestContext + ::std::marker::Send + ::std::marker::Sync + 'static, ::ContextStack: ::fbthrift::ContextStack::Frame> + ::std::marker::Send + ::std::marker::Sync + 'static, RS: ::fbthrift::ReplyState + ::std::marker::Send + ::std::marker::Sync + 'static, ::fbthrift::ProtocolDecoded

: ::std::clone::Clone, ::fbthrift::ProtocolEncodedFinal

: ::std::clone::Clone + ::fbthrift::BufExt, { type Handler = H; type RequestContext = R; type ReplyState = RS; #[tracing::instrument(level="trace", skip_all, fields(service = "FooService"))] async fn call( &self, req: ::fbthrift::ProtocolDecoded

, req_ctxt: &R, reply_state: ::std::sync::Arc, ) -> ::anyhow::Result<()> { use ::fbthrift::{ProtocolReader as _, ServiceProcessor as _}; let mut p = P::deserializer(req.clone()); let (idx, mty, seqid) = p.read_message_begin(|name| self.method_idx(name))?; if mty != ::fbthrift::MessageType::Call { return ::std::result::Result::Err(::std::convert::From::from(::fbthrift::ApplicationException::new( ::fbthrift::ApplicationExceptionErrorCode::InvalidMessageType, format!("message type {:?} not handled", mty) ))); } let idx = match idx { ::std::result::Result::Ok(idx) => idx, ::std::result::Result::Err(_) => { return self.supa.call(req, req_ctxt, reply_state).await; } }; self.handle_method(idx, &mut p, req, req_ctxt, reply_state, seqid).await?; p.read_message_end()?; ::std::result::Result::Ok(()) } fn create_interaction( &self, name: &::std::primitive::str, ) -> ::anyhow::Result< ::std::sync::Arc + ::std::marker::Send + 'static> > { use ::fbthrift::{ServiceProcessor as _}; let idx = self.create_interaction_idx(name); let idx = match idx { ::anyhow::Result::Ok(idx) => idx, ::anyhow::Result::Err(_) => { return self.supa.create_interaction(name); } }; self.handle_create_interaction(idx) } fn get_method_names(&self) -> &'static [&'static ::std::primitive::str] { &[ // From module.FooService: "simple_rpc", ] } async fn on_termination(&self) { use ::fbthrift::{ServiceProcessor as _}; self.handle_on_termination().await } } /// Construct a new instance of a FooService service. /// /// This is called when a new instance of a Thrift service Processor /// is needed for a particular Thrift protocol. #[::tracing::instrument(level="debug", skip_all, fields(proto = ?proto))] pub fn make_FooService_server( proto: ::fbthrift::ProtocolID, handler: H, ) -> ::std::result::Result<::std::boxed::Box + ::std::marker::Send + 'static>, ::fbthrift::ApplicationException> where F: ::fbthrift::Framing + ::std::marker::Send + ::std::marker::Sync + 'static, H: FooService, R: ::fbthrift::RequestContext + ::std::marker::Send + ::std::marker::Sync + 'static, ::ContextStack: ::fbthrift::ContextStack + ::std::marker::Send + ::std::marker::Sync + 'static, RS: ::fbthrift::ReplyState + ::std::marker::Send + ::std::marker::Sync + 'static, ::fbthrift::FramingDecoded: ::std::clone::Clone, ::fbthrift::FramingEncodedFinal: ::std::clone::Clone + ::fbthrift::BufExt, { match proto { ::fbthrift::ProtocolID::BinaryProtocol => { ::std::result::Result::Ok(::std::boxed::Box::new(FooServiceProcessor::<::fbthrift::BinaryProtocol, H, R, RS>::new(handler))) } ::fbthrift::ProtocolID::CompactProtocol => { ::std::result::Result::Ok(::std::boxed::Box::new(FooServiceProcessor::<::fbthrift::CompactProtocol, H, R, RS>::new(handler))) } bad => { ::tracing::error!(method = "FooService.", invalid_protocol = ?bad); ::std::result::Result::Err(::fbthrift::ApplicationException::invalid_protocol(bad)) } } } #[::async_trait::async_trait] pub trait FB303Service: ::std::marker::Send + ::std::marker::Sync + 'static { async fn simple_rpc( &self, _int_parameter: ::std::primitive::i32, ) -> ::std::result::Result { ::std::result::Result::Err(crate::services::f_b303_service::SimpleRpcExn::ApplicationException( ::fbthrift::ApplicationException::unimplemented_method( "FB303Service", "simple_rpc", ), )) } } #[::async_trait::async_trait] impl FB303Service for ::std::boxed::Box where T: FB303Service + Send + Sync + ?Sized, { async fn simple_rpc( &self, int_parameter: ::std::primitive::i32, ) -> ::std::result::Result { (**self).simple_rpc( int_parameter, ).await } } #[::async_trait::async_trait] impl FB303Service for ::std::sync::Arc where T: FB303Service + Send + Sync + ?Sized, { async fn simple_rpc( &self, int_parameter: ::std::primitive::i32, ) -> ::std::result::Result { (**self).simple_rpc( int_parameter, ).await } } /// Processor for FB303Service's methods. #[derive(Clone, Debug)] pub struct FB303ServiceProcessor { service: H, supa: ::fbthrift::NullServiceProcessor, _phantom: ::std::marker::PhantomData<(P, H, R, RS)>, } struct Args_FB303Service_simple_rpc { int_parameter: ::std::primitive::i32, } impl ::fbthrift::Deserialize

for self::Args_FB303Service_simple_rpc { #[inline] #[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "FB303Service.simple_rpc"))] fn read(p: &mut P) -> ::anyhow::Result { static ARGS: &[::fbthrift::Field] = &[ ::fbthrift::Field::new("int_parameter", ::fbthrift::TType::I32, 1), ]; let mut field_int_parameter = ::std::option::Option::None; let _ = p.read_struct_begin(|_| ())?; loop { let (_, fty, fid) = p.read_field_begin(|_| (), ARGS)?; match (fty, fid as ::std::primitive::i32) { (::fbthrift::TType::Stop, _) => break, (::fbthrift::TType::I32, 1) => field_int_parameter = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), (fty, _) => p.skip(fty)?, } p.read_field_end()?; } p.read_struct_end()?; ::std::result::Result::Ok(Self { int_parameter: field_int_parameter.ok_or_else(|| ::anyhow::anyhow!("`{}` missing arg `{}`", "FB303Service.simple_rpc", "int_parameter"))?, }) } } impl FB303ServiceProcessor where P: ::fbthrift::Protocol + ::std::marker::Send + ::std::marker::Sync + 'static, P::Frame: ::std::marker::Send + 'static, P::Deserializer: ::std::marker::Send, H: FB303Service, R: ::fbthrift::RequestContext + ::std::marker::Send + ::std::marker::Sync + 'static, RS: ::fbthrift::ReplyState + ::std::marker::Send + ::std::marker::Sync + 'static, ::ContextStack: ::fbthrift::ContextStack::Frame> + ::std::marker::Send + ::std::marker::Sync, ::fbthrift::ProtocolDecoded

: ::std::clone::Clone, ::fbthrift::ProtocolEncodedFinal

: ::std::clone::Clone + ::fbthrift::BufExt, { pub fn new(service: H) -> Self { Self { service, supa: ::fbthrift::NullServiceProcessor::new(), _phantom: ::std::marker::PhantomData, } } pub fn into_inner(self) -> H { self.service } #[::tracing::instrument(skip_all, name = "handler", fields(method = "FB303Service.simple_rpc"))] async fn handle_simple_rpc<'a>( &'a self, p: &'a mut P::Deserializer, req: ::fbthrift::ProtocolDecoded

, req_ctxt: &R, reply_state: ::std::sync::Arc, _seqid: ::std::primitive::u32, ) -> ::anyhow::Result<()> { use ::futures::FutureExt as _; const SERVICE_NAME: &::std::ffi::CStr = c"FB303Service"; const METHOD_NAME: &::std::ffi::CStr = c"simple_rpc"; const SERVICE_METHOD_NAME: &::std::ffi::CStr = c"FB303Service.simple_rpc"; let mut ctx_stack = req_ctxt.get_context_stack(SERVICE_NAME, SERVICE_METHOD_NAME)?; ::fbthrift::ContextStack::pre_read(&mut ctx_stack)?; let _args: self::Args_FB303Service_simple_rpc = ::fbthrift::Deserialize::read(p)?; let bytes_read = ::fbthrift::help::buf_len(&req)?; ::fbthrift::ContextStack::on_read_data(&mut ctx_stack, ::fbthrift::SerializedMessage { protocol: P::PROTOCOL_ID, method_name: METHOD_NAME, buffer: req, })?; ::fbthrift::ContextStack::post_read(&mut ctx_stack, bytes_read)?; let res = ::std::panic::AssertUnwindSafe( self.service.simple_rpc( _args.int_parameter, ) ) .catch_unwind() .await; // nested results - panic catch on the outside, method on the inside let res = match res { ::std::result::Result::Ok(::std::result::Result::Ok(res)) => { ::tracing::trace!(method = "FB303Service.simple_rpc", "success"); ::std::result::Result::Ok(res) } ::std::result::Result::Ok(::std::result::Result::Err(exn)) => { ::tracing::error!(method = "FB303Service.simple_rpc", exception = ?exn); ::std::result::Result::Err(exn) } ::std::result::Result::Err(exn) => { let aexn = ::fbthrift::ApplicationException::handler_panic("FB303Service.simple_rpc", exn); ::tracing::error!(method = "FB303Service.simple_rpc", panic = ?aexn); ::std::result::Result::Err(crate::services::f_b303_service::SimpleRpcExn::ApplicationException(aexn)) } }; let env = ::fbthrift::help::serialize_result_envelope::( "simple_rpc", METHOD_NAME, _seqid, req_ctxt, &mut ctx_stack, res, )?; reply_state.send_reply(env); ::std::result::Result::Ok(()) } } #[::async_trait::async_trait] impl ::fbthrift::ServiceProcessor

for FB303ServiceProcessor where P: ::fbthrift::Protocol + ::std::marker::Send + ::std::marker::Sync + 'static, P::Deserializer: ::std::marker::Send, H: FB303Service, P::Frame: ::std::marker::Send + 'static, R: ::fbthrift::RequestContext + ::std::marker::Send + ::std::marker::Sync + 'static, ::ContextStack: ::fbthrift::ContextStack::Frame> + ::std::marker::Send + ::std::marker::Sync + 'static, RS: ::fbthrift::ReplyState + ::std::marker::Send + ::std::marker::Sync + 'static, ::fbthrift::ProtocolDecoded

: ::std::clone::Clone, ::fbthrift::ProtocolEncodedFinal

: ::std::clone::Clone + ::fbthrift::BufExt, { type RequestContext = R; type ReplyState = RS; #[inline] fn method_idx(&self, name: &[::std::primitive::u8]) -> ::std::result::Result<::std::primitive::usize, ::fbthrift::ApplicationException> { match name { b"simple_rpc" => ::std::result::Result::Ok(0usize), _ => ::std::result::Result::Err(::fbthrift::ApplicationException::unknown_method()), } } #[allow(clippy::match_single_binding)] async fn handle_method( &self, idx: ::std::primitive::usize, _p: &mut P::Deserializer, _req: ::fbthrift::ProtocolDecoded

, _req_ctxt: &R, _reply_state: ::std::sync::Arc, _seqid: ::std::primitive::u32, ) -> ::anyhow::Result<()> { match idx { 0usize => { self.handle_simple_rpc(_p, _req, _req_ctxt, _reply_state, _seqid).await } bad => panic!( "{}: unexpected method idx {}", "FB303ServiceProcessor", bad ), } } #[allow(clippy::match_single_binding)] #[inline] fn create_interaction_idx(&self, name: &::std::primitive::str) -> ::anyhow::Result<::std::primitive::usize> { match name { _ => ::anyhow::bail!("Unknown interaction"), } } #[allow(clippy::match_single_binding)] fn handle_create_interaction( &self, idx: ::std::primitive::usize, ) -> ::anyhow::Result< ::std::sync::Arc + ::std::marker::Send + 'static> > { match idx { bad => panic!( "{}: unexpected method idx {}", "FB303ServiceProcessor", bad ), } } async fn handle_on_termination(&self) { } } #[::async_trait::async_trait] impl ::fbthrift::ThriftService for FB303ServiceProcessor where P: ::fbthrift::Protocol + ::std::marker::Send + ::std::marker::Sync + 'static, P::Deserializer: ::std::marker::Send, P::Frame: ::std::marker::Send + 'static, H: FB303Service, R: ::fbthrift::RequestContext + ::std::marker::Send + ::std::marker::Sync + 'static, ::ContextStack: ::fbthrift::ContextStack::Frame> + ::std::marker::Send + ::std::marker::Sync + 'static, RS: ::fbthrift::ReplyState + ::std::marker::Send + ::std::marker::Sync + 'static, ::fbthrift::ProtocolDecoded

: ::std::clone::Clone, ::fbthrift::ProtocolEncodedFinal

: ::std::clone::Clone + ::fbthrift::BufExt, { type Handler = H; type RequestContext = R; type ReplyState = RS; #[tracing::instrument(level="trace", skip_all, fields(service = "FB303Service"))] async fn call( &self, req: ::fbthrift::ProtocolDecoded

, req_ctxt: &R, reply_state: ::std::sync::Arc, ) -> ::anyhow::Result<()> { use ::fbthrift::{ProtocolReader as _, ServiceProcessor as _}; let mut p = P::deserializer(req.clone()); let (idx, mty, seqid) = p.read_message_begin(|name| self.method_idx(name))?; if mty != ::fbthrift::MessageType::Call { return ::std::result::Result::Err(::std::convert::From::from(::fbthrift::ApplicationException::new( ::fbthrift::ApplicationExceptionErrorCode::InvalidMessageType, format!("message type {:?} not handled", mty) ))); } let idx = match idx { ::std::result::Result::Ok(idx) => idx, ::std::result::Result::Err(_) => { return self.supa.call(req, req_ctxt, reply_state).await; } }; self.handle_method(idx, &mut p, req, req_ctxt, reply_state, seqid).await?; p.read_message_end()?; ::std::result::Result::Ok(()) } fn create_interaction( &self, name: &::std::primitive::str, ) -> ::anyhow::Result< ::std::sync::Arc + ::std::marker::Send + 'static> > { use ::fbthrift::{ServiceProcessor as _}; let idx = self.create_interaction_idx(name); let idx = match idx { ::anyhow::Result::Ok(idx) => idx, ::anyhow::Result::Err(_) => { return self.supa.create_interaction(name); } }; self.handle_create_interaction(idx) } fn get_method_names(&self) -> &'static [&'static ::std::primitive::str] { &[ // From module.FB303Service: "simple_rpc", ] } async fn on_termination(&self) { use ::fbthrift::{ServiceProcessor as _}; self.handle_on_termination().await } } /// Construct a new instance of a FB303Service service. /// /// This is called when a new instance of a Thrift service Processor /// is needed for a particular Thrift protocol. #[::tracing::instrument(level="debug", skip_all, fields(proto = ?proto))] pub fn make_FB303Service_server( proto: ::fbthrift::ProtocolID, handler: H, ) -> ::std::result::Result<::std::boxed::Box + ::std::marker::Send + 'static>, ::fbthrift::ApplicationException> where F: ::fbthrift::Framing + ::std::marker::Send + ::std::marker::Sync + 'static, H: FB303Service, R: ::fbthrift::RequestContext + ::std::marker::Send + ::std::marker::Sync + 'static, ::ContextStack: ::fbthrift::ContextStack + ::std::marker::Send + ::std::marker::Sync + 'static, RS: ::fbthrift::ReplyState + ::std::marker::Send + ::std::marker::Sync + 'static, ::fbthrift::FramingDecoded: ::std::clone::Clone, ::fbthrift::FramingEncodedFinal: ::std::clone::Clone + ::fbthrift::BufExt, { match proto { ::fbthrift::ProtocolID::BinaryProtocol => { ::std::result::Result::Ok(::std::boxed::Box::new(FB303ServiceProcessor::<::fbthrift::BinaryProtocol, H, R, RS>::new(handler))) } ::fbthrift::ProtocolID::CompactProtocol => { ::std::result::Result::Ok(::std::boxed::Box::new(FB303ServiceProcessor::<::fbthrift::CompactProtocol, H, R, RS>::new(handler))) } bad => { ::tracing::error!(method = "FB303Service.", invalid_protocol = ?bad); ::std::result::Result::Err(::fbthrift::ApplicationException::invalid_protocol(bad)) } } } #[::async_trait::async_trait] pub trait MyService: ::std::marker::Send + ::std::marker::Sync + 'static { async fn ping( &self, ) -> ::std::result::Result<(), crate::services::my_service::PingExn> { ::std::result::Result::Err(crate::services::my_service::PingExn::ApplicationException( ::fbthrift::ApplicationException::unimplemented_method( "MyService", "ping", ), )) } async fn getRandomData( &self, ) -> ::std::result::Result<::std::string::String, crate::services::my_service::GetRandomDataExn> { ::std::result::Result::Err(crate::services::my_service::GetRandomDataExn::ApplicationException( ::fbthrift::ApplicationException::unimplemented_method( "MyService", "getRandomData", ), )) } async fn sink( &self, _sink: ::std::primitive::i64, ) -> ::std::result::Result<(), crate::services::my_service::SinkExn> { ::std::result::Result::Err(crate::services::my_service::SinkExn::ApplicationException( ::fbthrift::ApplicationException::unimplemented_method( "MyService", "sink", ), )) } async fn putDataById( &self, _id: ::std::primitive::i64, _data: ::std::string::String, ) -> ::std::result::Result<(), crate::services::my_service::PutDataByIdExn> { ::std::result::Result::Err(crate::services::my_service::PutDataByIdExn::ApplicationException( ::fbthrift::ApplicationException::unimplemented_method( "MyService", "putDataById", ), )) } async fn hasDataById( &self, _id: ::std::primitive::i64, ) -> ::std::result::Result<::std::primitive::bool, crate::services::my_service::HasDataByIdExn> { ::std::result::Result::Err(crate::services::my_service::HasDataByIdExn::ApplicationException( ::fbthrift::ApplicationException::unimplemented_method( "MyService", "hasDataById", ), )) } async fn getDataById( &self, _id: ::std::primitive::i64, ) -> ::std::result::Result<::std::string::String, crate::services::my_service::GetDataByIdExn> { ::std::result::Result::Err(crate::services::my_service::GetDataByIdExn::ApplicationException( ::fbthrift::ApplicationException::unimplemented_method( "MyService", "getDataById", ), )) } async fn deleteDataById( &self, _id: ::std::primitive::i64, ) -> ::std::result::Result<(), crate::services::my_service::DeleteDataByIdExn> { ::std::result::Result::Err(crate::services::my_service::DeleteDataByIdExn::ApplicationException( ::fbthrift::ApplicationException::unimplemented_method( "MyService", "deleteDataById", ), )) } async fn lobDataById( &self, _id: ::std::primitive::i64, _data: ::std::string::String, ) -> ::std::result::Result<(), crate::services::my_service::LobDataByIdExn> { ::std::result::Result::Err(crate::services::my_service::LobDataByIdExn::ApplicationException( ::fbthrift::ApplicationException::unimplemented_method( "MyService", "lobDataById", ), )) } async fn invalid_return_for_hack( &self, ) -> ::std::result::Result<::std::collections::BTreeSet<::fbthrift::export::OrderedFloat<::std::primitive::f32>>, crate::services::my_service::InvalidReturnForHackExn> { ::std::result::Result::Err(crate::services::my_service::InvalidReturnForHackExn::ApplicationException( ::fbthrift::ApplicationException::unimplemented_method( "MyService", "invalid_return_for_hack", ), )) } async fn rpc_skipped_codegen( &self, ) -> ::std::result::Result<(), crate::services::my_service::RpcSkippedCodegenExn> { ::std::result::Result::Err(crate::services::my_service::RpcSkippedCodegenExn::ApplicationException( ::fbthrift::ApplicationException::unimplemented_method( "MyService", "rpc_skipped_codegen", ), )) } } #[::async_trait::async_trait] impl MyService for ::std::boxed::Box where T: MyService + Send + Sync + ?Sized, { async fn ping( &self, ) -> ::std::result::Result<(), crate::services::my_service::PingExn> { (**self).ping( ).await } async fn getRandomData( &self, ) -> ::std::result::Result<::std::string::String, crate::services::my_service::GetRandomDataExn> { (**self).getRandomData( ).await } async fn sink( &self, sink: ::std::primitive::i64, ) -> ::std::result::Result<(), crate::services::my_service::SinkExn> { (**self).sink( sink, ).await } async fn putDataById( &self, id: ::std::primitive::i64, data: ::std::string::String, ) -> ::std::result::Result<(), crate::services::my_service::PutDataByIdExn> { (**self).putDataById( id, data, ).await } async fn hasDataById( &self, id: ::std::primitive::i64, ) -> ::std::result::Result<::std::primitive::bool, crate::services::my_service::HasDataByIdExn> { (**self).hasDataById( id, ).await } async fn getDataById( &self, id: ::std::primitive::i64, ) -> ::std::result::Result<::std::string::String, crate::services::my_service::GetDataByIdExn> { (**self).getDataById( id, ).await } async fn deleteDataById( &self, id: ::std::primitive::i64, ) -> ::std::result::Result<(), crate::services::my_service::DeleteDataByIdExn> { (**self).deleteDataById( id, ).await } async fn lobDataById( &self, id: ::std::primitive::i64, data: ::std::string::String, ) -> ::std::result::Result<(), crate::services::my_service::LobDataByIdExn> { (**self).lobDataById( id, data, ).await } async fn invalid_return_for_hack( &self, ) -> ::std::result::Result<::std::collections::BTreeSet<::fbthrift::export::OrderedFloat<::std::primitive::f32>>, crate::services::my_service::InvalidReturnForHackExn> { (**self).invalid_return_for_hack( ).await } async fn rpc_skipped_codegen( &self, ) -> ::std::result::Result<(), crate::services::my_service::RpcSkippedCodegenExn> { (**self).rpc_skipped_codegen( ).await } } #[::async_trait::async_trait] impl MyService for ::std::sync::Arc where T: MyService + Send + Sync + ?Sized, { async fn ping( &self, ) -> ::std::result::Result<(), crate::services::my_service::PingExn> { (**self).ping( ).await } async fn getRandomData( &self, ) -> ::std::result::Result<::std::string::String, crate::services::my_service::GetRandomDataExn> { (**self).getRandomData( ).await } async fn sink( &self, sink: ::std::primitive::i64, ) -> ::std::result::Result<(), crate::services::my_service::SinkExn> { (**self).sink( sink, ).await } async fn putDataById( &self, id: ::std::primitive::i64, data: ::std::string::String, ) -> ::std::result::Result<(), crate::services::my_service::PutDataByIdExn> { (**self).putDataById( id, data, ).await } async fn hasDataById( &self, id: ::std::primitive::i64, ) -> ::std::result::Result<::std::primitive::bool, crate::services::my_service::HasDataByIdExn> { (**self).hasDataById( id, ).await } async fn getDataById( &self, id: ::std::primitive::i64, ) -> ::std::result::Result<::std::string::String, crate::services::my_service::GetDataByIdExn> { (**self).getDataById( id, ).await } async fn deleteDataById( &self, id: ::std::primitive::i64, ) -> ::std::result::Result<(), crate::services::my_service::DeleteDataByIdExn> { (**self).deleteDataById( id, ).await } async fn lobDataById( &self, id: ::std::primitive::i64, data: ::std::string::String, ) -> ::std::result::Result<(), crate::services::my_service::LobDataByIdExn> { (**self).lobDataById( id, data, ).await } async fn invalid_return_for_hack( &self, ) -> ::std::result::Result<::std::collections::BTreeSet<::fbthrift::export::OrderedFloat<::std::primitive::f32>>, crate::services::my_service::InvalidReturnForHackExn> { (**self).invalid_return_for_hack( ).await } async fn rpc_skipped_codegen( &self, ) -> ::std::result::Result<(), crate::services::my_service::RpcSkippedCodegenExn> { (**self).rpc_skipped_codegen( ).await } } /// Processor for MyService's methods. #[derive(Clone, Debug)] pub struct MyServiceProcessor { service: H, supa: ::fbthrift::NullServiceProcessor, _phantom: ::std::marker::PhantomData<(P, H, R, RS)>, } struct Args_MyService_ping { } impl ::fbthrift::Deserialize

for self::Args_MyService_ping { #[inline] #[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "MyService.ping"))] fn read(p: &mut P) -> ::anyhow::Result { static ARGS: &[::fbthrift::Field] = &[ ]; let _ = p.read_struct_begin(|_| ())?; loop { let (_, fty, fid) = p.read_field_begin(|_| (), ARGS)?; match (fty, fid as ::std::primitive::i32) { (::fbthrift::TType::Stop, _) => break, (fty, _) => p.skip(fty)?, } p.read_field_end()?; } p.read_struct_end()?; ::std::result::Result::Ok(Self { }) } } struct Args_MyService_getRandomData { } impl ::fbthrift::Deserialize

for self::Args_MyService_getRandomData { #[inline] #[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "MyService.getRandomData"))] fn read(p: &mut P) -> ::anyhow::Result { static ARGS: &[::fbthrift::Field] = &[ ]; let _ = p.read_struct_begin(|_| ())?; loop { let (_, fty, fid) = p.read_field_begin(|_| (), ARGS)?; match (fty, fid as ::std::primitive::i32) { (::fbthrift::TType::Stop, _) => break, (fty, _) => p.skip(fty)?, } p.read_field_end()?; } p.read_struct_end()?; ::std::result::Result::Ok(Self { }) } } struct Args_MyService_sink { sink: ::std::primitive::i64, } impl ::fbthrift::Deserialize

for self::Args_MyService_sink { #[inline] #[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "MyService.sink"))] fn read(p: &mut P) -> ::anyhow::Result { static ARGS: &[::fbthrift::Field] = &[ ::fbthrift::Field::new("sink", ::fbthrift::TType::I64, 1), ]; let mut field_sink = ::std::option::Option::None; let _ = p.read_struct_begin(|_| ())?; loop { let (_, fty, fid) = p.read_field_begin(|_| (), ARGS)?; match (fty, fid as ::std::primitive::i32) { (::fbthrift::TType::Stop, _) => break, (::fbthrift::TType::I64, 1) => field_sink = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), (fty, _) => p.skip(fty)?, } p.read_field_end()?; } p.read_struct_end()?; ::std::result::Result::Ok(Self { sink: field_sink.ok_or_else(|| ::anyhow::anyhow!("`{}` missing arg `{}`", "MyService.sink", "sink"))?, }) } } struct Args_MyService_putDataById { id: ::std::primitive::i64, data: ::std::string::String, } impl ::fbthrift::Deserialize

for self::Args_MyService_putDataById { #[inline] #[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "MyService.putDataById"))] fn read(p: &mut P) -> ::anyhow::Result { static ARGS: &[::fbthrift::Field] = &[ ::fbthrift::Field::new("data", ::fbthrift::TType::String, 2), ::fbthrift::Field::new("id", ::fbthrift::TType::I64, 1), ]; let mut field_id = ::std::option::Option::None; let mut field_data = ::std::option::Option::None; let _ = p.read_struct_begin(|_| ())?; loop { let (_, fty, fid) = p.read_field_begin(|_| (), ARGS)?; match (fty, fid as ::std::primitive::i32) { (::fbthrift::TType::Stop, _) => break, (::fbthrift::TType::I64, 1) => field_id = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), (::fbthrift::TType::String, 2) => field_data = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), (fty, _) => p.skip(fty)?, } p.read_field_end()?; } p.read_struct_end()?; ::std::result::Result::Ok(Self { id: field_id.ok_or_else(|| ::anyhow::anyhow!("`{}` missing arg `{}`", "MyService.putDataById", "id"))?, data: field_data.ok_or_else(|| ::anyhow::anyhow!("`{}` missing arg `{}`", "MyService.putDataById", "data"))?, }) } } struct Args_MyService_hasDataById { id: ::std::primitive::i64, } impl ::fbthrift::Deserialize

for self::Args_MyService_hasDataById { #[inline] #[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "MyService.hasDataById"))] fn read(p: &mut P) -> ::anyhow::Result { static ARGS: &[::fbthrift::Field] = &[ ::fbthrift::Field::new("id", ::fbthrift::TType::I64, 1), ]; let mut field_id = ::std::option::Option::None; let _ = p.read_struct_begin(|_| ())?; loop { let (_, fty, fid) = p.read_field_begin(|_| (), ARGS)?; match (fty, fid as ::std::primitive::i32) { (::fbthrift::TType::Stop, _) => break, (::fbthrift::TType::I64, 1) => field_id = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), (fty, _) => p.skip(fty)?, } p.read_field_end()?; } p.read_struct_end()?; ::std::result::Result::Ok(Self { id: field_id.ok_or_else(|| ::anyhow::anyhow!("`{}` missing arg `{}`", "MyService.hasDataById", "id"))?, }) } } struct Args_MyService_getDataById { id: ::std::primitive::i64, } impl ::fbthrift::Deserialize

for self::Args_MyService_getDataById { #[inline] #[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "MyService.getDataById"))] fn read(p: &mut P) -> ::anyhow::Result { static ARGS: &[::fbthrift::Field] = &[ ::fbthrift::Field::new("id", ::fbthrift::TType::I64, 1), ]; let mut field_id = ::std::option::Option::None; let _ = p.read_struct_begin(|_| ())?; loop { let (_, fty, fid) = p.read_field_begin(|_| (), ARGS)?; match (fty, fid as ::std::primitive::i32) { (::fbthrift::TType::Stop, _) => break, (::fbthrift::TType::I64, 1) => field_id = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), (fty, _) => p.skip(fty)?, } p.read_field_end()?; } p.read_struct_end()?; ::std::result::Result::Ok(Self { id: field_id.ok_or_else(|| ::anyhow::anyhow!("`{}` missing arg `{}`", "MyService.getDataById", "id"))?, }) } } struct Args_MyService_deleteDataById { id: ::std::primitive::i64, } impl ::fbthrift::Deserialize

for self::Args_MyService_deleteDataById { #[inline] #[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "MyService.deleteDataById"))] fn read(p: &mut P) -> ::anyhow::Result { static ARGS: &[::fbthrift::Field] = &[ ::fbthrift::Field::new("id", ::fbthrift::TType::I64, 1), ]; let mut field_id = ::std::option::Option::None; let _ = p.read_struct_begin(|_| ())?; loop { let (_, fty, fid) = p.read_field_begin(|_| (), ARGS)?; match (fty, fid as ::std::primitive::i32) { (::fbthrift::TType::Stop, _) => break, (::fbthrift::TType::I64, 1) => field_id = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), (fty, _) => p.skip(fty)?, } p.read_field_end()?; } p.read_struct_end()?; ::std::result::Result::Ok(Self { id: field_id.ok_or_else(|| ::anyhow::anyhow!("`{}` missing arg `{}`", "MyService.deleteDataById", "id"))?, }) } } struct Args_MyService_lobDataById { id: ::std::primitive::i64, data: ::std::string::String, } impl ::fbthrift::Deserialize

for self::Args_MyService_lobDataById { #[inline] #[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "MyService.lobDataById"))] fn read(p: &mut P) -> ::anyhow::Result { static ARGS: &[::fbthrift::Field] = &[ ::fbthrift::Field::new("data", ::fbthrift::TType::String, 2), ::fbthrift::Field::new("id", ::fbthrift::TType::I64, 1), ]; let mut field_id = ::std::option::Option::None; let mut field_data = ::std::option::Option::None; let _ = p.read_struct_begin(|_| ())?; loop { let (_, fty, fid) = p.read_field_begin(|_| (), ARGS)?; match (fty, fid as ::std::primitive::i32) { (::fbthrift::TType::Stop, _) => break, (::fbthrift::TType::I64, 1) => field_id = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), (::fbthrift::TType::String, 2) => field_data = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), (fty, _) => p.skip(fty)?, } p.read_field_end()?; } p.read_struct_end()?; ::std::result::Result::Ok(Self { id: field_id.ok_or_else(|| ::anyhow::anyhow!("`{}` missing arg `{}`", "MyService.lobDataById", "id"))?, data: field_data.ok_or_else(|| ::anyhow::anyhow!("`{}` missing arg `{}`", "MyService.lobDataById", "data"))?, }) } } struct Args_MyService_invalid_return_for_hack { } impl ::fbthrift::Deserialize

for self::Args_MyService_invalid_return_for_hack { #[inline] #[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "MyService.invalid_return_for_hack"))] fn read(p: &mut P) -> ::anyhow::Result { static ARGS: &[::fbthrift::Field] = &[ ]; let _ = p.read_struct_begin(|_| ())?; loop { let (_, fty, fid) = p.read_field_begin(|_| (), ARGS)?; match (fty, fid as ::std::primitive::i32) { (::fbthrift::TType::Stop, _) => break, (fty, _) => p.skip(fty)?, } p.read_field_end()?; } p.read_struct_end()?; ::std::result::Result::Ok(Self { }) } } struct Args_MyService_rpc_skipped_codegen { } impl ::fbthrift::Deserialize

for self::Args_MyService_rpc_skipped_codegen { #[inline] #[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "MyService.rpc_skipped_codegen"))] fn read(p: &mut P) -> ::anyhow::Result { static ARGS: &[::fbthrift::Field] = &[ ]; let _ = p.read_struct_begin(|_| ())?; loop { let (_, fty, fid) = p.read_field_begin(|_| (), ARGS)?; match (fty, fid as ::std::primitive::i32) { (::fbthrift::TType::Stop, _) => break, (fty, _) => p.skip(fty)?, } p.read_field_end()?; } p.read_struct_end()?; ::std::result::Result::Ok(Self { }) } } impl MyServiceProcessor where P: ::fbthrift::Protocol + ::std::marker::Send + ::std::marker::Sync + 'static, P::Frame: ::std::marker::Send + 'static, P::Deserializer: ::std::marker::Send, H: MyService, R: ::fbthrift::RequestContext + ::std::marker::Send + ::std::marker::Sync + 'static, RS: ::fbthrift::ReplyState + ::std::marker::Send + ::std::marker::Sync + 'static, ::ContextStack: ::fbthrift::ContextStack::Frame> + ::std::marker::Send + ::std::marker::Sync, ::fbthrift::ProtocolDecoded

: ::std::clone::Clone, ::fbthrift::ProtocolEncodedFinal

: ::std::clone::Clone + ::fbthrift::BufExt, { pub fn new(service: H) -> Self { Self { service, supa: ::fbthrift::NullServiceProcessor::new(), _phantom: ::std::marker::PhantomData, } } pub fn into_inner(self) -> H { self.service } #[::tracing::instrument(skip_all, name = "handler", fields(method = "MyService.ping"))] async fn handle_ping<'a>( &'a self, p: &'a mut P::Deserializer, req: ::fbthrift::ProtocolDecoded

, req_ctxt: &R, reply_state: ::std::sync::Arc, _seqid: ::std::primitive::u32, ) -> ::anyhow::Result<()> { use ::futures::FutureExt as _; const SERVICE_NAME: &::std::ffi::CStr = c"MyService"; const METHOD_NAME: &::std::ffi::CStr = c"ping"; const SERVICE_METHOD_NAME: &::std::ffi::CStr = c"MyService.ping"; let mut ctx_stack = req_ctxt.get_context_stack(SERVICE_NAME, SERVICE_METHOD_NAME)?; ::fbthrift::ContextStack::pre_read(&mut ctx_stack)?; let _args: self::Args_MyService_ping = ::fbthrift::Deserialize::read(p)?; let bytes_read = ::fbthrift::help::buf_len(&req)?; ::fbthrift::ContextStack::on_read_data(&mut ctx_stack, ::fbthrift::SerializedMessage { protocol: P::PROTOCOL_ID, method_name: METHOD_NAME, buffer: req, })?; ::fbthrift::ContextStack::post_read(&mut ctx_stack, bytes_read)?; let res = ::std::panic::AssertUnwindSafe( self.service.ping( ) ) .catch_unwind() .await; // nested results - panic catch on the outside, method on the inside let res = match res { ::std::result::Result::Ok(::std::result::Result::Ok(res)) => { ::tracing::trace!(method = "MyService.ping", "success"); ::std::result::Result::Ok(res) } ::std::result::Result::Ok(::std::result::Result::Err(exn)) => { ::tracing::error!(method = "MyService.ping", exception = ?exn); ::std::result::Result::Err(exn) } ::std::result::Result::Err(exn) => { let aexn = ::fbthrift::ApplicationException::handler_panic("MyService.ping", exn); ::tracing::error!(method = "MyService.ping", panic = ?aexn); ::std::result::Result::Err(crate::services::my_service::PingExn::ApplicationException(aexn)) } }; let env = ::fbthrift::help::serialize_result_envelope::( "ping", METHOD_NAME, _seqid, req_ctxt, &mut ctx_stack, res, )?; reply_state.send_reply(env); ::std::result::Result::Ok(()) } #[::tracing::instrument(skip_all, name = "handler", fields(method = "MyService.getRandomData"))] async fn handle_getRandomData<'a>( &'a self, p: &'a mut P::Deserializer, req: ::fbthrift::ProtocolDecoded

, req_ctxt: &R, reply_state: ::std::sync::Arc, _seqid: ::std::primitive::u32, ) -> ::anyhow::Result<()> { use ::futures::FutureExt as _; const SERVICE_NAME: &::std::ffi::CStr = c"MyService"; const METHOD_NAME: &::std::ffi::CStr = c"getRandomData"; const SERVICE_METHOD_NAME: &::std::ffi::CStr = c"MyService.getRandomData"; let mut ctx_stack = req_ctxt.get_context_stack(SERVICE_NAME, SERVICE_METHOD_NAME)?; ::fbthrift::ContextStack::pre_read(&mut ctx_stack)?; let _args: self::Args_MyService_getRandomData = ::fbthrift::Deserialize::read(p)?; let bytes_read = ::fbthrift::help::buf_len(&req)?; ::fbthrift::ContextStack::on_read_data(&mut ctx_stack, ::fbthrift::SerializedMessage { protocol: P::PROTOCOL_ID, method_name: METHOD_NAME, buffer: req, })?; ::fbthrift::ContextStack::post_read(&mut ctx_stack, bytes_read)?; let res = ::std::panic::AssertUnwindSafe( self.service.getRandomData( ) ) .catch_unwind() .await; // nested results - panic catch on the outside, method on the inside let res = match res { ::std::result::Result::Ok(::std::result::Result::Ok(res)) => { ::tracing::trace!(method = "MyService.getRandomData", "success"); ::std::result::Result::Ok(res) } ::std::result::Result::Ok(::std::result::Result::Err(exn)) => { ::tracing::error!(method = "MyService.getRandomData", exception = ?exn); ::std::result::Result::Err(exn) } ::std::result::Result::Err(exn) => { let aexn = ::fbthrift::ApplicationException::handler_panic("MyService.getRandomData", exn); ::tracing::error!(method = "MyService.getRandomData", panic = ?aexn); ::std::result::Result::Err(crate::services::my_service::GetRandomDataExn::ApplicationException(aexn)) } }; let env = ::fbthrift::help::serialize_result_envelope::( "getRandomData", METHOD_NAME, _seqid, req_ctxt, &mut ctx_stack, res, )?; reply_state.send_reply(env); ::std::result::Result::Ok(()) } #[::tracing::instrument(skip_all, name = "handler", fields(method = "MyService.sink"))] async fn handle_sink<'a>( &'a self, p: &'a mut P::Deserializer, req: ::fbthrift::ProtocolDecoded

, req_ctxt: &R, reply_state: ::std::sync::Arc, _seqid: ::std::primitive::u32, ) -> ::anyhow::Result<()> { use ::futures::FutureExt as _; const SERVICE_NAME: &::std::ffi::CStr = c"MyService"; const METHOD_NAME: &::std::ffi::CStr = c"sink"; const SERVICE_METHOD_NAME: &::std::ffi::CStr = c"MyService.sink"; let mut ctx_stack = req_ctxt.get_context_stack(SERVICE_NAME, SERVICE_METHOD_NAME)?; ::fbthrift::ContextStack::pre_read(&mut ctx_stack)?; let _args: self::Args_MyService_sink = ::fbthrift::Deserialize::read(p)?; let bytes_read = ::fbthrift::help::buf_len(&req)?; ::fbthrift::ContextStack::on_read_data(&mut ctx_stack, ::fbthrift::SerializedMessage { protocol: P::PROTOCOL_ID, method_name: METHOD_NAME, buffer: req, })?; ::fbthrift::ContextStack::post_read(&mut ctx_stack, bytes_read)?; let res = ::std::panic::AssertUnwindSafe( self.service.sink( _args.sink, ) ) .catch_unwind() .await; // nested results - panic catch on the outside, method on the inside let res = match res { ::std::result::Result::Ok(::std::result::Result::Ok(res)) => { ::tracing::trace!(method = "MyService.sink", "success"); ::std::result::Result::Ok(res) } ::std::result::Result::Ok(::std::result::Result::Err(exn)) => { ::tracing::error!(method = "MyService.sink", exception = ?exn); ::std::result::Result::Err(exn) } ::std::result::Result::Err(exn) => { let aexn = ::fbthrift::ApplicationException::handler_panic("MyService.sink", exn); ::tracing::error!(method = "MyService.sink", panic = ?aexn); ::std::result::Result::Err(crate::services::my_service::SinkExn::ApplicationException(aexn)) } }; let env = ::fbthrift::help::serialize_result_envelope::( "sink", METHOD_NAME, _seqid, req_ctxt, &mut ctx_stack, res, )?; reply_state.send_reply(env); ::std::result::Result::Ok(()) } #[::tracing::instrument(skip_all, name = "handler", fields(method = "MyService.putDataById"))] async fn handle_putDataById<'a>( &'a self, p: &'a mut P::Deserializer, req: ::fbthrift::ProtocolDecoded

, req_ctxt: &R, reply_state: ::std::sync::Arc, _seqid: ::std::primitive::u32, ) -> ::anyhow::Result<()> { use ::futures::FutureExt as _; const SERVICE_NAME: &::std::ffi::CStr = c"MyService"; const METHOD_NAME: &::std::ffi::CStr = c"putDataById"; const SERVICE_METHOD_NAME: &::std::ffi::CStr = c"MyService.putDataById"; let mut ctx_stack = req_ctxt.get_context_stack(SERVICE_NAME, SERVICE_METHOD_NAME)?; ::fbthrift::ContextStack::pre_read(&mut ctx_stack)?; let _args: self::Args_MyService_putDataById = ::fbthrift::Deserialize::read(p)?; let bytes_read = ::fbthrift::help::buf_len(&req)?; ::fbthrift::ContextStack::on_read_data(&mut ctx_stack, ::fbthrift::SerializedMessage { protocol: P::PROTOCOL_ID, method_name: METHOD_NAME, buffer: req, })?; ::fbthrift::ContextStack::post_read(&mut ctx_stack, bytes_read)?; let res = ::std::panic::AssertUnwindSafe( self.service.putDataById( _args.id, _args.data, ) ) .catch_unwind() .await; // nested results - panic catch on the outside, method on the inside let res = match res { ::std::result::Result::Ok(::std::result::Result::Ok(res)) => { ::tracing::trace!(method = "MyService.putDataById", "success"); ::std::result::Result::Ok(res) } ::std::result::Result::Ok(::std::result::Result::Err(exn)) => { ::tracing::error!(method = "MyService.putDataById", exception = ?exn); ::std::result::Result::Err(exn) } ::std::result::Result::Err(exn) => { let aexn = ::fbthrift::ApplicationException::handler_panic("MyService.putDataById", exn); ::tracing::error!(method = "MyService.putDataById", panic = ?aexn); ::std::result::Result::Err(crate::services::my_service::PutDataByIdExn::ApplicationException(aexn)) } }; let env = ::fbthrift::help::serialize_result_envelope::( "putDataById", METHOD_NAME, _seqid, req_ctxt, &mut ctx_stack, res, )?; reply_state.send_reply(env); ::std::result::Result::Ok(()) } #[::tracing::instrument(skip_all, name = "handler", fields(method = "MyService.hasDataById"))] async fn handle_hasDataById<'a>( &'a self, p: &'a mut P::Deserializer, req: ::fbthrift::ProtocolDecoded

, req_ctxt: &R, reply_state: ::std::sync::Arc, _seqid: ::std::primitive::u32, ) -> ::anyhow::Result<()> { use ::futures::FutureExt as _; const SERVICE_NAME: &::std::ffi::CStr = c"MyService"; const METHOD_NAME: &::std::ffi::CStr = c"hasDataById"; const SERVICE_METHOD_NAME: &::std::ffi::CStr = c"MyService.hasDataById"; let mut ctx_stack = req_ctxt.get_context_stack(SERVICE_NAME, SERVICE_METHOD_NAME)?; ::fbthrift::ContextStack::pre_read(&mut ctx_stack)?; let _args: self::Args_MyService_hasDataById = ::fbthrift::Deserialize::read(p)?; let bytes_read = ::fbthrift::help::buf_len(&req)?; ::fbthrift::ContextStack::on_read_data(&mut ctx_stack, ::fbthrift::SerializedMessage { protocol: P::PROTOCOL_ID, method_name: METHOD_NAME, buffer: req, })?; ::fbthrift::ContextStack::post_read(&mut ctx_stack, bytes_read)?; let res = ::std::panic::AssertUnwindSafe( self.service.hasDataById( _args.id, ) ) .catch_unwind() .await; // nested results - panic catch on the outside, method on the inside let res = match res { ::std::result::Result::Ok(::std::result::Result::Ok(res)) => { ::tracing::trace!(method = "MyService.hasDataById", "success"); ::std::result::Result::Ok(res) } ::std::result::Result::Ok(::std::result::Result::Err(exn)) => { ::tracing::error!(method = "MyService.hasDataById", exception = ?exn); ::std::result::Result::Err(exn) } ::std::result::Result::Err(exn) => { let aexn = ::fbthrift::ApplicationException::handler_panic("MyService.hasDataById", exn); ::tracing::error!(method = "MyService.hasDataById", panic = ?aexn); ::std::result::Result::Err(crate::services::my_service::HasDataByIdExn::ApplicationException(aexn)) } }; let env = ::fbthrift::help::serialize_result_envelope::( "hasDataById", METHOD_NAME, _seqid, req_ctxt, &mut ctx_stack, res, )?; reply_state.send_reply(env); ::std::result::Result::Ok(()) } #[::tracing::instrument(skip_all, name = "handler", fields(method = "MyService.getDataById"))] async fn handle_getDataById<'a>( &'a self, p: &'a mut P::Deserializer, req: ::fbthrift::ProtocolDecoded

, req_ctxt: &R, reply_state: ::std::sync::Arc, _seqid: ::std::primitive::u32, ) -> ::anyhow::Result<()> { use ::futures::FutureExt as _; const SERVICE_NAME: &::std::ffi::CStr = c"MyService"; const METHOD_NAME: &::std::ffi::CStr = c"getDataById"; const SERVICE_METHOD_NAME: &::std::ffi::CStr = c"MyService.getDataById"; let mut ctx_stack = req_ctxt.get_context_stack(SERVICE_NAME, SERVICE_METHOD_NAME)?; ::fbthrift::ContextStack::pre_read(&mut ctx_stack)?; let _args: self::Args_MyService_getDataById = ::fbthrift::Deserialize::read(p)?; let bytes_read = ::fbthrift::help::buf_len(&req)?; ::fbthrift::ContextStack::on_read_data(&mut ctx_stack, ::fbthrift::SerializedMessage { protocol: P::PROTOCOL_ID, method_name: METHOD_NAME, buffer: req, })?; ::fbthrift::ContextStack::post_read(&mut ctx_stack, bytes_read)?; let res = ::std::panic::AssertUnwindSafe( self.service.getDataById( _args.id, ) ) .catch_unwind() .await; // nested results - panic catch on the outside, method on the inside let res = match res { ::std::result::Result::Ok(::std::result::Result::Ok(res)) => { ::tracing::trace!(method = "MyService.getDataById", "success"); ::std::result::Result::Ok(res) } ::std::result::Result::Ok(::std::result::Result::Err(exn)) => { ::tracing::error!(method = "MyService.getDataById", exception = ?exn); ::std::result::Result::Err(exn) } ::std::result::Result::Err(exn) => { let aexn = ::fbthrift::ApplicationException::handler_panic("MyService.getDataById", exn); ::tracing::error!(method = "MyService.getDataById", panic = ?aexn); ::std::result::Result::Err(crate::services::my_service::GetDataByIdExn::ApplicationException(aexn)) } }; let env = ::fbthrift::help::serialize_result_envelope::( "getDataById", METHOD_NAME, _seqid, req_ctxt, &mut ctx_stack, res, )?; reply_state.send_reply(env); ::std::result::Result::Ok(()) } #[::tracing::instrument(skip_all, name = "handler", fields(method = "MyService.deleteDataById"))] async fn handle_deleteDataById<'a>( &'a self, p: &'a mut P::Deserializer, req: ::fbthrift::ProtocolDecoded

, req_ctxt: &R, reply_state: ::std::sync::Arc, _seqid: ::std::primitive::u32, ) -> ::anyhow::Result<()> { use ::futures::FutureExt as _; const SERVICE_NAME: &::std::ffi::CStr = c"MyService"; const METHOD_NAME: &::std::ffi::CStr = c"deleteDataById"; const SERVICE_METHOD_NAME: &::std::ffi::CStr = c"MyService.deleteDataById"; let mut ctx_stack = req_ctxt.get_context_stack(SERVICE_NAME, SERVICE_METHOD_NAME)?; ::fbthrift::ContextStack::pre_read(&mut ctx_stack)?; let _args: self::Args_MyService_deleteDataById = ::fbthrift::Deserialize::read(p)?; let bytes_read = ::fbthrift::help::buf_len(&req)?; ::fbthrift::ContextStack::on_read_data(&mut ctx_stack, ::fbthrift::SerializedMessage { protocol: P::PROTOCOL_ID, method_name: METHOD_NAME, buffer: req, })?; ::fbthrift::ContextStack::post_read(&mut ctx_stack, bytes_read)?; let res = ::std::panic::AssertUnwindSafe( self.service.deleteDataById( _args.id, ) ) .catch_unwind() .await; // nested results - panic catch on the outside, method on the inside let res = match res { ::std::result::Result::Ok(::std::result::Result::Ok(res)) => { ::tracing::trace!(method = "MyService.deleteDataById", "success"); ::std::result::Result::Ok(res) } ::std::result::Result::Ok(::std::result::Result::Err(exn)) => { ::tracing::error!(method = "MyService.deleteDataById", exception = ?exn); ::std::result::Result::Err(exn) } ::std::result::Result::Err(exn) => { let aexn = ::fbthrift::ApplicationException::handler_panic("MyService.deleteDataById", exn); ::tracing::error!(method = "MyService.deleteDataById", panic = ?aexn); ::std::result::Result::Err(crate::services::my_service::DeleteDataByIdExn::ApplicationException(aexn)) } }; let env = ::fbthrift::help::serialize_result_envelope::( "deleteDataById", METHOD_NAME, _seqid, req_ctxt, &mut ctx_stack, res, )?; reply_state.send_reply(env); ::std::result::Result::Ok(()) } #[::tracing::instrument(skip_all, name = "handler", fields(method = "MyService.lobDataById"))] async fn handle_lobDataById<'a>( &'a self, p: &'a mut P::Deserializer, req: ::fbthrift::ProtocolDecoded

, req_ctxt: &R, reply_state: ::std::sync::Arc, _seqid: ::std::primitive::u32, ) -> ::anyhow::Result<()> { use ::futures::FutureExt as _; const SERVICE_NAME: &::std::ffi::CStr = c"MyService"; const METHOD_NAME: &::std::ffi::CStr = c"lobDataById"; const SERVICE_METHOD_NAME: &::std::ffi::CStr = c"MyService.lobDataById"; let mut ctx_stack = req_ctxt.get_context_stack(SERVICE_NAME, SERVICE_METHOD_NAME)?; ::fbthrift::ContextStack::pre_read(&mut ctx_stack)?; let _args: self::Args_MyService_lobDataById = ::fbthrift::Deserialize::read(p)?; let bytes_read = ::fbthrift::help::buf_len(&req)?; ::fbthrift::ContextStack::on_read_data(&mut ctx_stack, ::fbthrift::SerializedMessage { protocol: P::PROTOCOL_ID, method_name: METHOD_NAME, buffer: req, })?; ::fbthrift::ContextStack::post_read(&mut ctx_stack, bytes_read)?; let res = ::std::panic::AssertUnwindSafe( self.service.lobDataById( _args.id, _args.data, ) ) .catch_unwind() .await; // nested results - panic catch on the outside, method on the inside let res = match res { ::std::result::Result::Ok(::std::result::Result::Ok(res)) => { ::tracing::trace!(method = "MyService.lobDataById", "success"); ::std::result::Result::Ok(res) } ::std::result::Result::Ok(::std::result::Result::Err(exn)) => { ::tracing::error!(method = "MyService.lobDataById", exception = ?exn); ::std::result::Result::Err(exn) } ::std::result::Result::Err(exn) => { let aexn = ::fbthrift::ApplicationException::handler_panic("MyService.lobDataById", exn); ::tracing::error!(method = "MyService.lobDataById", panic = ?aexn); ::std::result::Result::Err(crate::services::my_service::LobDataByIdExn::ApplicationException(aexn)) } }; let env = ::fbthrift::help::serialize_result_envelope::( "lobDataById", METHOD_NAME, _seqid, req_ctxt, &mut ctx_stack, res, )?; reply_state.send_reply(env); ::std::result::Result::Ok(()) } #[::tracing::instrument(skip_all, name = "handler", fields(method = "MyService.invalid_return_for_hack"))] async fn handle_invalid_return_for_hack<'a>( &'a self, p: &'a mut P::Deserializer, req: ::fbthrift::ProtocolDecoded

, req_ctxt: &R, reply_state: ::std::sync::Arc, _seqid: ::std::primitive::u32, ) -> ::anyhow::Result<()> { use ::futures::FutureExt as _; const SERVICE_NAME: &::std::ffi::CStr = c"MyService"; const METHOD_NAME: &::std::ffi::CStr = c"invalid_return_for_hack"; const SERVICE_METHOD_NAME: &::std::ffi::CStr = c"MyService.invalid_return_for_hack"; let mut ctx_stack = req_ctxt.get_context_stack(SERVICE_NAME, SERVICE_METHOD_NAME)?; ::fbthrift::ContextStack::pre_read(&mut ctx_stack)?; let _args: self::Args_MyService_invalid_return_for_hack = ::fbthrift::Deserialize::read(p)?; let bytes_read = ::fbthrift::help::buf_len(&req)?; ::fbthrift::ContextStack::on_read_data(&mut ctx_stack, ::fbthrift::SerializedMessage { protocol: P::PROTOCOL_ID, method_name: METHOD_NAME, buffer: req, })?; ::fbthrift::ContextStack::post_read(&mut ctx_stack, bytes_read)?; let res = ::std::panic::AssertUnwindSafe( self.service.invalid_return_for_hack( ) ) .catch_unwind() .await; // nested results - panic catch on the outside, method on the inside let res = match res { ::std::result::Result::Ok(::std::result::Result::Ok(res)) => { ::tracing::trace!(method = "MyService.invalid_return_for_hack", "success"); ::std::result::Result::Ok(res) } ::std::result::Result::Ok(::std::result::Result::Err(exn)) => { ::tracing::error!(method = "MyService.invalid_return_for_hack", exception = ?exn); ::std::result::Result::Err(exn) } ::std::result::Result::Err(exn) => { let aexn = ::fbthrift::ApplicationException::handler_panic("MyService.invalid_return_for_hack", exn); ::tracing::error!(method = "MyService.invalid_return_for_hack", panic = ?aexn); ::std::result::Result::Err(crate::services::my_service::InvalidReturnForHackExn::ApplicationException(aexn)) } }; let env = ::fbthrift::help::serialize_result_envelope::( "invalid_return_for_hack", METHOD_NAME, _seqid, req_ctxt, &mut ctx_stack, res, )?; reply_state.send_reply(env); ::std::result::Result::Ok(()) } #[::tracing::instrument(skip_all, name = "handler", fields(method = "MyService.rpc_skipped_codegen"))] async fn handle_rpc_skipped_codegen<'a>( &'a self, p: &'a mut P::Deserializer, req: ::fbthrift::ProtocolDecoded

, req_ctxt: &R, reply_state: ::std::sync::Arc, _seqid: ::std::primitive::u32, ) -> ::anyhow::Result<()> { use ::futures::FutureExt as _; const SERVICE_NAME: &::std::ffi::CStr = c"MyService"; const METHOD_NAME: &::std::ffi::CStr = c"rpc_skipped_codegen"; const SERVICE_METHOD_NAME: &::std::ffi::CStr = c"MyService.rpc_skipped_codegen"; let mut ctx_stack = req_ctxt.get_context_stack(SERVICE_NAME, SERVICE_METHOD_NAME)?; ::fbthrift::ContextStack::pre_read(&mut ctx_stack)?; let _args: self::Args_MyService_rpc_skipped_codegen = ::fbthrift::Deserialize::read(p)?; let bytes_read = ::fbthrift::help::buf_len(&req)?; ::fbthrift::ContextStack::on_read_data(&mut ctx_stack, ::fbthrift::SerializedMessage { protocol: P::PROTOCOL_ID, method_name: METHOD_NAME, buffer: req, })?; ::fbthrift::ContextStack::post_read(&mut ctx_stack, bytes_read)?; let res = ::std::panic::AssertUnwindSafe( self.service.rpc_skipped_codegen( ) ) .catch_unwind() .await; // nested results - panic catch on the outside, method on the inside let res = match res { ::std::result::Result::Ok(::std::result::Result::Ok(res)) => { ::tracing::trace!(method = "MyService.rpc_skipped_codegen", "success"); ::std::result::Result::Ok(res) } ::std::result::Result::Ok(::std::result::Result::Err(exn)) => { ::tracing::error!(method = "MyService.rpc_skipped_codegen", exception = ?exn); ::std::result::Result::Err(exn) } ::std::result::Result::Err(exn) => { let aexn = ::fbthrift::ApplicationException::handler_panic("MyService.rpc_skipped_codegen", exn); ::tracing::error!(method = "MyService.rpc_skipped_codegen", panic = ?aexn); ::std::result::Result::Err(crate::services::my_service::RpcSkippedCodegenExn::ApplicationException(aexn)) } }; let env = ::fbthrift::help::serialize_result_envelope::( "rpc_skipped_codegen", METHOD_NAME, _seqid, req_ctxt, &mut ctx_stack, res, )?; reply_state.send_reply(env); ::std::result::Result::Ok(()) } } #[::async_trait::async_trait] impl ::fbthrift::ServiceProcessor

for MyServiceProcessor where P: ::fbthrift::Protocol + ::std::marker::Send + ::std::marker::Sync + 'static, P::Deserializer: ::std::marker::Send, H: MyService, P::Frame: ::std::marker::Send + 'static, R: ::fbthrift::RequestContext + ::std::marker::Send + ::std::marker::Sync + 'static, ::ContextStack: ::fbthrift::ContextStack::Frame> + ::std::marker::Send + ::std::marker::Sync + 'static, RS: ::fbthrift::ReplyState + ::std::marker::Send + ::std::marker::Sync + 'static, ::fbthrift::ProtocolDecoded

: ::std::clone::Clone, ::fbthrift::ProtocolEncodedFinal

: ::std::clone::Clone + ::fbthrift::BufExt, { type RequestContext = R; type ReplyState = RS; #[inline] fn method_idx(&self, name: &[::std::primitive::u8]) -> ::std::result::Result<::std::primitive::usize, ::fbthrift::ApplicationException> { match name { b"ping" => ::std::result::Result::Ok(0usize), b"getRandomData" => ::std::result::Result::Ok(1usize), b"sink" => ::std::result::Result::Ok(2usize), b"putDataById" => ::std::result::Result::Ok(3usize), b"hasDataById" => ::std::result::Result::Ok(4usize), b"getDataById" => ::std::result::Result::Ok(5usize), b"deleteDataById" => ::std::result::Result::Ok(6usize), b"lobDataById" => ::std::result::Result::Ok(7usize), b"invalid_return_for_hack" => ::std::result::Result::Ok(8usize), b"rpc_skipped_codegen" => ::std::result::Result::Ok(9usize), _ => ::std::result::Result::Err(::fbthrift::ApplicationException::unknown_method()), } } #[allow(clippy::match_single_binding)] async fn handle_method( &self, idx: ::std::primitive::usize, _p: &mut P::Deserializer, _req: ::fbthrift::ProtocolDecoded

, _req_ctxt: &R, _reply_state: ::std::sync::Arc, _seqid: ::std::primitive::u32, ) -> ::anyhow::Result<()> { match idx { 0usize => { self.handle_ping(_p, _req, _req_ctxt, _reply_state, _seqid).await } 1usize => { self.handle_getRandomData(_p, _req, _req_ctxt, _reply_state, _seqid).await } 2usize => { self.handle_sink(_p, _req, _req_ctxt, _reply_state, _seqid).await } 3usize => { self.handle_putDataById(_p, _req, _req_ctxt, _reply_state, _seqid).await } 4usize => { self.handle_hasDataById(_p, _req, _req_ctxt, _reply_state, _seqid).await } 5usize => { self.handle_getDataById(_p, _req, _req_ctxt, _reply_state, _seqid).await } 6usize => { self.handle_deleteDataById(_p, _req, _req_ctxt, _reply_state, _seqid).await } 7usize => { self.handle_lobDataById(_p, _req, _req_ctxt, _reply_state, _seqid).await } 8usize => { self.handle_invalid_return_for_hack(_p, _req, _req_ctxt, _reply_state, _seqid).await } 9usize => { self.handle_rpc_skipped_codegen(_p, _req, _req_ctxt, _reply_state, _seqid).await } bad => panic!( "{}: unexpected method idx {}", "MyServiceProcessor", bad ), } } #[allow(clippy::match_single_binding)] #[inline] fn create_interaction_idx(&self, name: &::std::primitive::str) -> ::anyhow::Result<::std::primitive::usize> { match name { _ => ::anyhow::bail!("Unknown interaction"), } } #[allow(clippy::match_single_binding)] fn handle_create_interaction( &self, idx: ::std::primitive::usize, ) -> ::anyhow::Result< ::std::sync::Arc + ::std::marker::Send + 'static> > { match idx { bad => panic!( "{}: unexpected method idx {}", "MyServiceProcessor", bad ), } } async fn handle_on_termination(&self) { } } #[::async_trait::async_trait] impl ::fbthrift::ThriftService for MyServiceProcessor where P: ::fbthrift::Protocol + ::std::marker::Send + ::std::marker::Sync + 'static, P::Deserializer: ::std::marker::Send, P::Frame: ::std::marker::Send + 'static, H: MyService, R: ::fbthrift::RequestContext + ::std::marker::Send + ::std::marker::Sync + 'static, ::ContextStack: ::fbthrift::ContextStack::Frame> + ::std::marker::Send + ::std::marker::Sync + 'static, RS: ::fbthrift::ReplyState + ::std::marker::Send + ::std::marker::Sync + 'static, ::fbthrift::ProtocolDecoded

: ::std::clone::Clone, ::fbthrift::ProtocolEncodedFinal

: ::std::clone::Clone + ::fbthrift::BufExt, { type Handler = H; type RequestContext = R; type ReplyState = RS; #[tracing::instrument(level="trace", skip_all, fields(service = "MyService"))] async fn call( &self, req: ::fbthrift::ProtocolDecoded

, req_ctxt: &R, reply_state: ::std::sync::Arc, ) -> ::anyhow::Result<()> { use ::fbthrift::{ProtocolReader as _, ServiceProcessor as _}; let mut p = P::deserializer(req.clone()); let (idx, mty, seqid) = p.read_message_begin(|name| self.method_idx(name))?; if mty != ::fbthrift::MessageType::Call { return ::std::result::Result::Err(::std::convert::From::from(::fbthrift::ApplicationException::new( ::fbthrift::ApplicationExceptionErrorCode::InvalidMessageType, format!("message type {:?} not handled", mty) ))); } let idx = match idx { ::std::result::Result::Ok(idx) => idx, ::std::result::Result::Err(_) => { return self.supa.call(req, req_ctxt, reply_state).await; } }; self.handle_method(idx, &mut p, req, req_ctxt, reply_state, seqid).await?; p.read_message_end()?; ::std::result::Result::Ok(()) } fn create_interaction( &self, name: &::std::primitive::str, ) -> ::anyhow::Result< ::std::sync::Arc + ::std::marker::Send + 'static> > { use ::fbthrift::{ServiceProcessor as _}; let idx = self.create_interaction_idx(name); let idx = match idx { ::anyhow::Result::Ok(idx) => idx, ::anyhow::Result::Err(_) => { return self.supa.create_interaction(name); } }; self.handle_create_interaction(idx) } fn get_method_names(&self) -> &'static [&'static ::std::primitive::str] { &[ // From module.MyService: "ping", "getRandomData", "sink", "putDataById", "hasDataById", "getDataById", "deleteDataById", "lobDataById", "invalid_return_for_hack", "rpc_skipped_codegen", ] } async fn on_termination(&self) { use ::fbthrift::{ServiceProcessor as _}; self.handle_on_termination().await } } /// Construct a new instance of a MyService service. /// /// This is called when a new instance of a Thrift service Processor /// is needed for a particular Thrift protocol. #[::tracing::instrument(level="debug", skip_all, fields(proto = ?proto))] pub fn make_MyService_server( proto: ::fbthrift::ProtocolID, handler: H, ) -> ::std::result::Result<::std::boxed::Box + ::std::marker::Send + 'static>, ::fbthrift::ApplicationException> where F: ::fbthrift::Framing + ::std::marker::Send + ::std::marker::Sync + 'static, H: MyService, R: ::fbthrift::RequestContext + ::std::marker::Send + ::std::marker::Sync + 'static, ::ContextStack: ::fbthrift::ContextStack + ::std::marker::Send + ::std::marker::Sync + 'static, RS: ::fbthrift::ReplyState + ::std::marker::Send + ::std::marker::Sync + 'static, ::fbthrift::FramingDecoded: ::std::clone::Clone, ::fbthrift::FramingEncodedFinal: ::std::clone::Clone + ::fbthrift::BufExt, { match proto { ::fbthrift::ProtocolID::BinaryProtocol => { ::std::result::Result::Ok(::std::boxed::Box::new(MyServiceProcessor::<::fbthrift::BinaryProtocol, H, R, RS>::new(handler))) } ::fbthrift::ProtocolID::CompactProtocol => { ::std::result::Result::Ok(::std::boxed::Box::new(MyServiceProcessor::<::fbthrift::CompactProtocol, H, R, RS>::new(handler))) } bad => { ::tracing::error!(method = "MyService.", invalid_protocol = ?bad); ::std::result::Result::Err(::fbthrift::ApplicationException::invalid_protocol(bad)) } } } #[::async_trait::async_trait] pub trait DbMixedStackArguments: ::std::marker::Send + ::std::marker::Sync + 'static { async fn getDataByKey0( &self, _key: ::std::string::String, ) -> ::std::result::Result<::std::vec::Vec<::std::primitive::u8>, crate::services::db_mixed_stack_arguments::GetDataByKey0Exn> { ::std::result::Result::Err(crate::services::db_mixed_stack_arguments::GetDataByKey0Exn::ApplicationException( ::fbthrift::ApplicationException::unimplemented_method( "DbMixedStackArguments", "getDataByKey0", ), )) } async fn getDataByKey1( &self, _key: ::std::string::String, ) -> ::std::result::Result<::std::vec::Vec<::std::primitive::u8>, crate::services::db_mixed_stack_arguments::GetDataByKey1Exn> { ::std::result::Result::Err(crate::services::db_mixed_stack_arguments::GetDataByKey1Exn::ApplicationException( ::fbthrift::ApplicationException::unimplemented_method( "DbMixedStackArguments", "getDataByKey1", ), )) } } #[::async_trait::async_trait] impl DbMixedStackArguments for ::std::boxed::Box where T: DbMixedStackArguments + Send + Sync + ?Sized, { async fn getDataByKey0( &self, key: ::std::string::String, ) -> ::std::result::Result<::std::vec::Vec<::std::primitive::u8>, crate::services::db_mixed_stack_arguments::GetDataByKey0Exn> { (**self).getDataByKey0( key, ).await } async fn getDataByKey1( &self, key: ::std::string::String, ) -> ::std::result::Result<::std::vec::Vec<::std::primitive::u8>, crate::services::db_mixed_stack_arguments::GetDataByKey1Exn> { (**self).getDataByKey1( key, ).await } } #[::async_trait::async_trait] impl DbMixedStackArguments for ::std::sync::Arc where T: DbMixedStackArguments + Send + Sync + ?Sized, { async fn getDataByKey0( &self, key: ::std::string::String, ) -> ::std::result::Result<::std::vec::Vec<::std::primitive::u8>, crate::services::db_mixed_stack_arguments::GetDataByKey0Exn> { (**self).getDataByKey0( key, ).await } async fn getDataByKey1( &self, key: ::std::string::String, ) -> ::std::result::Result<::std::vec::Vec<::std::primitive::u8>, crate::services::db_mixed_stack_arguments::GetDataByKey1Exn> { (**self).getDataByKey1( key, ).await } } /// Processor for DbMixedStackArguments's methods. #[derive(Clone, Debug)] pub struct DbMixedStackArgumentsProcessor { service: H, supa: ::fbthrift::NullServiceProcessor, _phantom: ::std::marker::PhantomData<(P, H, R, RS)>, } struct Args_DbMixedStackArguments_getDataByKey0 { key: ::std::string::String, } impl ::fbthrift::Deserialize

for self::Args_DbMixedStackArguments_getDataByKey0 { #[inline] #[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "DbMixedStackArguments.getDataByKey0"))] fn read(p: &mut P) -> ::anyhow::Result { static ARGS: &[::fbthrift::Field] = &[ ::fbthrift::Field::new("key", ::fbthrift::TType::String, 1), ]; let mut field_key = ::std::option::Option::None; let _ = p.read_struct_begin(|_| ())?; loop { let (_, fty, fid) = p.read_field_begin(|_| (), ARGS)?; match (fty, fid as ::std::primitive::i32) { (::fbthrift::TType::Stop, _) => break, (::fbthrift::TType::String, 1) => field_key = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), (fty, _) => p.skip(fty)?, } p.read_field_end()?; } p.read_struct_end()?; ::std::result::Result::Ok(Self { key: field_key.ok_or_else(|| ::anyhow::anyhow!("`{}` missing arg `{}`", "DbMixedStackArguments.getDataByKey0", "key"))?, }) } } struct Args_DbMixedStackArguments_getDataByKey1 { key: ::std::string::String, } impl ::fbthrift::Deserialize

for self::Args_DbMixedStackArguments_getDataByKey1 { #[inline] #[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "DbMixedStackArguments.getDataByKey1"))] fn read(p: &mut P) -> ::anyhow::Result { static ARGS: &[::fbthrift::Field] = &[ ::fbthrift::Field::new("key", ::fbthrift::TType::String, 1), ]; let mut field_key = ::std::option::Option::None; let _ = p.read_struct_begin(|_| ())?; loop { let (_, fty, fid) = p.read_field_begin(|_| (), ARGS)?; match (fty, fid as ::std::primitive::i32) { (::fbthrift::TType::Stop, _) => break, (::fbthrift::TType::String, 1) => field_key = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), (fty, _) => p.skip(fty)?, } p.read_field_end()?; } p.read_struct_end()?; ::std::result::Result::Ok(Self { key: field_key.ok_or_else(|| ::anyhow::anyhow!("`{}` missing arg `{}`", "DbMixedStackArguments.getDataByKey1", "key"))?, }) } } impl DbMixedStackArgumentsProcessor where P: ::fbthrift::Protocol + ::std::marker::Send + ::std::marker::Sync + 'static, P::Frame: ::std::marker::Send + 'static, P::Deserializer: ::std::marker::Send, H: DbMixedStackArguments, R: ::fbthrift::RequestContext + ::std::marker::Send + ::std::marker::Sync + 'static, RS: ::fbthrift::ReplyState + ::std::marker::Send + ::std::marker::Sync + 'static, ::ContextStack: ::fbthrift::ContextStack::Frame> + ::std::marker::Send + ::std::marker::Sync, ::fbthrift::ProtocolDecoded

: ::std::clone::Clone, ::fbthrift::ProtocolEncodedFinal

: ::std::clone::Clone + ::fbthrift::BufExt, { pub fn new(service: H) -> Self { Self { service, supa: ::fbthrift::NullServiceProcessor::new(), _phantom: ::std::marker::PhantomData, } } pub fn into_inner(self) -> H { self.service } #[::tracing::instrument(skip_all, name = "handler", fields(method = "DbMixedStackArguments.getDataByKey0"))] async fn handle_getDataByKey0<'a>( &'a self, p: &'a mut P::Deserializer, req: ::fbthrift::ProtocolDecoded

, req_ctxt: &R, reply_state: ::std::sync::Arc, _seqid: ::std::primitive::u32, ) -> ::anyhow::Result<()> { use ::futures::FutureExt as _; const SERVICE_NAME: &::std::ffi::CStr = c"DbMixedStackArguments"; const METHOD_NAME: &::std::ffi::CStr = c"getDataByKey0"; const SERVICE_METHOD_NAME: &::std::ffi::CStr = c"DbMixedStackArguments.getDataByKey0"; let mut ctx_stack = req_ctxt.get_context_stack(SERVICE_NAME, SERVICE_METHOD_NAME)?; ::fbthrift::ContextStack::pre_read(&mut ctx_stack)?; let _args: self::Args_DbMixedStackArguments_getDataByKey0 = ::fbthrift::Deserialize::read(p)?; let bytes_read = ::fbthrift::help::buf_len(&req)?; ::fbthrift::ContextStack::on_read_data(&mut ctx_stack, ::fbthrift::SerializedMessage { protocol: P::PROTOCOL_ID, method_name: METHOD_NAME, buffer: req, })?; ::fbthrift::ContextStack::post_read(&mut ctx_stack, bytes_read)?; let res = ::std::panic::AssertUnwindSafe( self.service.getDataByKey0( _args.key, ) ) .catch_unwind() .await; // nested results - panic catch on the outside, method on the inside let res = match res { ::std::result::Result::Ok(::std::result::Result::Ok(res)) => { ::tracing::trace!(method = "DbMixedStackArguments.getDataByKey0", "success"); ::std::result::Result::Ok(res) } ::std::result::Result::Ok(::std::result::Result::Err(exn)) => { ::tracing::error!(method = "DbMixedStackArguments.getDataByKey0", exception = ?exn); ::std::result::Result::Err(exn) } ::std::result::Result::Err(exn) => { let aexn = ::fbthrift::ApplicationException::handler_panic("DbMixedStackArguments.getDataByKey0", exn); ::tracing::error!(method = "DbMixedStackArguments.getDataByKey0", panic = ?aexn); ::std::result::Result::Err(crate::services::db_mixed_stack_arguments::GetDataByKey0Exn::ApplicationException(aexn)) } }; let env = ::fbthrift::help::serialize_result_envelope::( "getDataByKey0", METHOD_NAME, _seqid, req_ctxt, &mut ctx_stack, res, )?; reply_state.send_reply(env); ::std::result::Result::Ok(()) } #[::tracing::instrument(skip_all, name = "handler", fields(method = "DbMixedStackArguments.getDataByKey1"))] async fn handle_getDataByKey1<'a>( &'a self, p: &'a mut P::Deserializer, req: ::fbthrift::ProtocolDecoded

, req_ctxt: &R, reply_state: ::std::sync::Arc, _seqid: ::std::primitive::u32, ) -> ::anyhow::Result<()> { use ::futures::FutureExt as _; const SERVICE_NAME: &::std::ffi::CStr = c"DbMixedStackArguments"; const METHOD_NAME: &::std::ffi::CStr = c"getDataByKey1"; const SERVICE_METHOD_NAME: &::std::ffi::CStr = c"DbMixedStackArguments.getDataByKey1"; let mut ctx_stack = req_ctxt.get_context_stack(SERVICE_NAME, SERVICE_METHOD_NAME)?; ::fbthrift::ContextStack::pre_read(&mut ctx_stack)?; let _args: self::Args_DbMixedStackArguments_getDataByKey1 = ::fbthrift::Deserialize::read(p)?; let bytes_read = ::fbthrift::help::buf_len(&req)?; ::fbthrift::ContextStack::on_read_data(&mut ctx_stack, ::fbthrift::SerializedMessage { protocol: P::PROTOCOL_ID, method_name: METHOD_NAME, buffer: req, })?; ::fbthrift::ContextStack::post_read(&mut ctx_stack, bytes_read)?; let res = ::std::panic::AssertUnwindSafe( self.service.getDataByKey1( _args.key, ) ) .catch_unwind() .await; // nested results - panic catch on the outside, method on the inside let res = match res { ::std::result::Result::Ok(::std::result::Result::Ok(res)) => { ::tracing::trace!(method = "DbMixedStackArguments.getDataByKey1", "success"); ::std::result::Result::Ok(res) } ::std::result::Result::Ok(::std::result::Result::Err(exn)) => { ::tracing::error!(method = "DbMixedStackArguments.getDataByKey1", exception = ?exn); ::std::result::Result::Err(exn) } ::std::result::Result::Err(exn) => { let aexn = ::fbthrift::ApplicationException::handler_panic("DbMixedStackArguments.getDataByKey1", exn); ::tracing::error!(method = "DbMixedStackArguments.getDataByKey1", panic = ?aexn); ::std::result::Result::Err(crate::services::db_mixed_stack_arguments::GetDataByKey1Exn::ApplicationException(aexn)) } }; let env = ::fbthrift::help::serialize_result_envelope::( "getDataByKey1", METHOD_NAME, _seqid, req_ctxt, &mut ctx_stack, res, )?; reply_state.send_reply(env); ::std::result::Result::Ok(()) } } #[::async_trait::async_trait] impl ::fbthrift::ServiceProcessor

for DbMixedStackArgumentsProcessor where P: ::fbthrift::Protocol + ::std::marker::Send + ::std::marker::Sync + 'static, P::Deserializer: ::std::marker::Send, H: DbMixedStackArguments, P::Frame: ::std::marker::Send + 'static, R: ::fbthrift::RequestContext + ::std::marker::Send + ::std::marker::Sync + 'static, ::ContextStack: ::fbthrift::ContextStack::Frame> + ::std::marker::Send + ::std::marker::Sync + 'static, RS: ::fbthrift::ReplyState + ::std::marker::Send + ::std::marker::Sync + 'static, ::fbthrift::ProtocolDecoded

: ::std::clone::Clone, ::fbthrift::ProtocolEncodedFinal

: ::std::clone::Clone + ::fbthrift::BufExt, { type RequestContext = R; type ReplyState = RS; #[inline] fn method_idx(&self, name: &[::std::primitive::u8]) -> ::std::result::Result<::std::primitive::usize, ::fbthrift::ApplicationException> { match name { b"getDataByKey0" => ::std::result::Result::Ok(0usize), b"getDataByKey1" => ::std::result::Result::Ok(1usize), _ => ::std::result::Result::Err(::fbthrift::ApplicationException::unknown_method()), } } #[allow(clippy::match_single_binding)] async fn handle_method( &self, idx: ::std::primitive::usize, _p: &mut P::Deserializer, _req: ::fbthrift::ProtocolDecoded

, _req_ctxt: &R, _reply_state: ::std::sync::Arc, _seqid: ::std::primitive::u32, ) -> ::anyhow::Result<()> { match idx { 0usize => { self.handle_getDataByKey0(_p, _req, _req_ctxt, _reply_state, _seqid).await } 1usize => { self.handle_getDataByKey1(_p, _req, _req_ctxt, _reply_state, _seqid).await } bad => panic!( "{}: unexpected method idx {}", "DbMixedStackArgumentsProcessor", bad ), } } #[allow(clippy::match_single_binding)] #[inline] fn create_interaction_idx(&self, name: &::std::primitive::str) -> ::anyhow::Result<::std::primitive::usize> { match name { _ => ::anyhow::bail!("Unknown interaction"), } } #[allow(clippy::match_single_binding)] fn handle_create_interaction( &self, idx: ::std::primitive::usize, ) -> ::anyhow::Result< ::std::sync::Arc + ::std::marker::Send + 'static> > { match idx { bad => panic!( "{}: unexpected method idx {}", "DbMixedStackArgumentsProcessor", bad ), } } async fn handle_on_termination(&self) { } } #[::async_trait::async_trait] impl ::fbthrift::ThriftService for DbMixedStackArgumentsProcessor where P: ::fbthrift::Protocol + ::std::marker::Send + ::std::marker::Sync + 'static, P::Deserializer: ::std::marker::Send, P::Frame: ::std::marker::Send + 'static, H: DbMixedStackArguments, R: ::fbthrift::RequestContext + ::std::marker::Send + ::std::marker::Sync + 'static, ::ContextStack: ::fbthrift::ContextStack::Frame> + ::std::marker::Send + ::std::marker::Sync + 'static, RS: ::fbthrift::ReplyState + ::std::marker::Send + ::std::marker::Sync + 'static, ::fbthrift::ProtocolDecoded

: ::std::clone::Clone, ::fbthrift::ProtocolEncodedFinal

: ::std::clone::Clone + ::fbthrift::BufExt, { type Handler = H; type RequestContext = R; type ReplyState = RS; #[tracing::instrument(level="trace", skip_all, fields(service = "DbMixedStackArguments"))] async fn call( &self, req: ::fbthrift::ProtocolDecoded

, req_ctxt: &R, reply_state: ::std::sync::Arc, ) -> ::anyhow::Result<()> { use ::fbthrift::{ProtocolReader as _, ServiceProcessor as _}; let mut p = P::deserializer(req.clone()); let (idx, mty, seqid) = p.read_message_begin(|name| self.method_idx(name))?; if mty != ::fbthrift::MessageType::Call { return ::std::result::Result::Err(::std::convert::From::from(::fbthrift::ApplicationException::new( ::fbthrift::ApplicationExceptionErrorCode::InvalidMessageType, format!("message type {:?} not handled", mty) ))); } let idx = match idx { ::std::result::Result::Ok(idx) => idx, ::std::result::Result::Err(_) => { return self.supa.call(req, req_ctxt, reply_state).await; } }; self.handle_method(idx, &mut p, req, req_ctxt, reply_state, seqid).await?; p.read_message_end()?; ::std::result::Result::Ok(()) } fn create_interaction( &self, name: &::std::primitive::str, ) -> ::anyhow::Result< ::std::sync::Arc + ::std::marker::Send + 'static> > { use ::fbthrift::{ServiceProcessor as _}; let idx = self.create_interaction_idx(name); let idx = match idx { ::anyhow::Result::Ok(idx) => idx, ::anyhow::Result::Err(_) => { return self.supa.create_interaction(name); } }; self.handle_create_interaction(idx) } fn get_method_names(&self) -> &'static [&'static ::std::primitive::str] { &[ // From module.DbMixedStackArguments: "getDataByKey0", "getDataByKey1", ] } async fn on_termination(&self) { use ::fbthrift::{ServiceProcessor as _}; self.handle_on_termination().await } } /// Construct a new instance of a DbMixedStackArguments service. /// /// This is called when a new instance of a Thrift service Processor /// is needed for a particular Thrift protocol. #[::tracing::instrument(level="debug", skip_all, fields(proto = ?proto))] pub fn make_DbMixedStackArguments_server( proto: ::fbthrift::ProtocolID, handler: H, ) -> ::std::result::Result<::std::boxed::Box + ::std::marker::Send + 'static>, ::fbthrift::ApplicationException> where F: ::fbthrift::Framing + ::std::marker::Send + ::std::marker::Sync + 'static, H: DbMixedStackArguments, R: ::fbthrift::RequestContext + ::std::marker::Send + ::std::marker::Sync + 'static, ::ContextStack: ::fbthrift::ContextStack + ::std::marker::Send + ::std::marker::Sync + 'static, RS: ::fbthrift::ReplyState + ::std::marker::Send + ::std::marker::Sync + 'static, ::fbthrift::FramingDecoded: ::std::clone::Clone, ::fbthrift::FramingEncodedFinal: ::std::clone::Clone + ::fbthrift::BufExt, { match proto { ::fbthrift::ProtocolID::BinaryProtocol => { ::std::result::Result::Ok(::std::boxed::Box::new(DbMixedStackArgumentsProcessor::<::fbthrift::BinaryProtocol, H, R, RS>::new(handler))) } ::fbthrift::ProtocolID::CompactProtocol => { ::std::result::Result::Ok(::std::boxed::Box::new(DbMixedStackArgumentsProcessor::<::fbthrift::CompactProtocol, H, R, RS>::new(handler))) } bad => { ::tracing::error!(method = "DbMixedStackArguments.", invalid_protocol = ?bad); ::std::result::Result::Err(::fbthrift::ApplicationException::invalid_protocol(bad)) } } }