// @generated by Thrift for thrift/compiler/test/fixtures/rust-request-context/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::my_service; #[doc(inline)] #[allow(ambiguous_glob_reexports)] pub use ::::services::my_service::*; #[doc(inline)] pub use ::::services::my_interaction; #[doc(inline)] #[allow(ambiguous_glob_reexports)] pub use ::::services::my_interaction::*; } pub(crate) use crate as server; pub(crate) use ::::services; #[::async_trait::async_trait] pub trait MyInteraction: ::std::marker::Send + ::std::marker::Sync + 'static { async fn ping( &self, ) -> ::std::result::Result<(), crate::services::my_interaction::PingExn> { ::std::result::Result::Err(crate::services::my_interaction::PingExn::ApplicationException( ::fbthrift::ApplicationException::unimplemented_method( "MyInteraction", "ping", ), )) } async fn on_termination(&self) {} } #[::async_trait::async_trait] impl MyInteraction for ::std::boxed::Box where T: MyInteraction + Send + Sync + ?Sized, { async fn ping( &self, ) -> ::std::result::Result<(), crate::services::my_interaction::PingExn> { (**self).ping( ).await } async fn on_termination(&self) { (**self).on_termination().await; } } #[::async_trait::async_trait] impl MyInteraction for ::std::sync::Arc where T: MyInteraction + Send + Sync + ?Sized, { async fn ping( &self, ) -> ::std::result::Result<(), crate::services::my_interaction::PingExn> { (**self).ping( ).await } async fn on_termination(&self) { (**self).on_termination().await; } } /// Processor for MyInteraction's methods. #[derive(Clone, Debug)] pub struct MyInteractionProcessor { service: H, supa: ::fbthrift::NullServiceProcessor, _phantom: ::std::marker::PhantomData<(P, H, R, RS)>, } struct Args_MyInteraction_ping { } impl ::fbthrift::Deserialize

for self::Args_MyInteraction_ping { #[inline] #[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "MyInteraction.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 { }) } } impl MyInteractionProcessor where P: ::fbthrift::Protocol + ::std::marker::Send + ::std::marker::Sync + 'static, P::Frame: ::std::marker::Send + 'static, P::Deserializer: ::std::marker::Send, H: MyInteraction, 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 = "MyInteraction.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 ::const_cstr::const_cstr; use ::futures::FutureExt as _; const_cstr! { SERVICE_NAME = "MyService"; METHOD_NAME = "MyInteraction.ping"; SERVICE_METHOD_NAME = "MyService.MyInteraction.ping"; } let mut ctx_stack = req_ctxt.get_context_stack( SERVICE_NAME.as_cstr(), SERVICE_METHOD_NAME.as_cstr(), )?; ::fbthrift::ContextStack::pre_read(&mut ctx_stack)?; let _args: self::Args_MyInteraction_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.as_cstr(), 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 = "MyInteraction.ping", "success"); ::std::result::Result::Ok(res) } ::std::result::Result::Ok(::std::result::Result::Err(exn)) => { ::tracing::info!(method = "MyInteraction.ping", exception = ?exn); ::std::result::Result::Err(exn) } ::std::result::Result::Err(exn) => { let aexn = ::fbthrift::ApplicationException::handler_panic("MyInteraction.ping", exn); ::tracing::error!(method = "MyInteraction.ping", panic = ?aexn); ::std::result::Result::Err(crate::services::my_interaction::PingExn::ApplicationException(aexn)) } }; let env = ::fbthrift::help::serialize_result_envelope::( "ping", METHOD_NAME.as_cstr(), _seqid, req_ctxt, &mut ctx_stack, res, )?; reply_state.send_reply(env); Ok(()) } } #[::async_trait::async_trait] impl ::fbthrift::ServiceProcessor

for MyInteractionProcessor where P: ::fbthrift::Protocol + ::std::marker::Send + ::std::marker::Sync + 'static, P::Deserializer: ::std::marker::Send, H: MyInteraction, 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"MyInteraction.ping" => ::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_ping(_p, _req, _req_ctxt, _reply_state, _seqid).await } bad => panic!( "{}: unexpected method idx {}", "MyInteractionProcessor", bad ), } } #[allow(clippy::match_single_binding)] #[inline] fn create_interaction_idx(&self, name: &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 {}", "MyInteractionProcessor", bad ), } } async fn handle_on_termination(&self) { self.service.on_termination().await } } #[::async_trait::async_trait] impl ::fbthrift::ThriftService for MyInteractionProcessor where P: ::fbthrift::Protocol + ::std::marker::Send + ::std::marker::Sync + 'static, P::Deserializer: ::std::marker::Send, P::Frame: ::std::marker::Send + 'static, H: MyInteraction, 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, { // Interactions have () as their handler associated type // to make `create_interaction` have a common return type. type Handler = (); type RequestContext = R; type ReplyState = RS; #[tracing::instrument(level="trace", skip_all, fields(service = "MyInteraction"))] 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()?; Ok(()) } fn create_interaction( &self, name: &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 str] { &[ // interaction's method names are never queried directly. // they are always queried from the "main" processor. ] } async fn on_termination(&self) { use ::fbthrift::{ServiceProcessor as _}; self.handle_on_termination().await } } #[::async_trait::async_trait] pub trait MyService: ::std::marker::Send + ::std::marker::Sync + 'static { type RequestContext: ::std::marker::Sync; async fn ping( &self, _request_context: &Self::RequestContext, ) -> ::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, _request_context: &Self::RequestContext, ) -> ::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 hasDataById( &self, _request_context: &Self::RequestContext, _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, _request_context: &Self::RequestContext, _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 putDataById( &self, _request_context: &Self::RequestContext, _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 lobDataById( &self, _request_context: &Self::RequestContext, _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 streamById( &self, _request_context: &Self::RequestContext, _id: ::std::primitive::i64, ) -> ::std::result::Result< ::futures::stream::BoxStream<'static, ::std::result::Result> , crate::services::my_service::StreamByIdExn> { ::std::result::Result::Err(crate::services::my_service::StreamByIdExn::ApplicationException( ::fbthrift::ApplicationException::unimplemented_method( "MyService", "streamById", ), )) } async fn streamByIdWithException( &self, _request_context: &Self::RequestContext, _id: ::std::primitive::i64, ) -> ::std::result::Result< ::futures::stream::BoxStream<'static, ::std::result::Result> , crate::services::my_service::StreamByIdWithExceptionExn> { ::std::result::Result::Err(crate::services::my_service::StreamByIdWithExceptionExn::ApplicationException( ::fbthrift::ApplicationException::unimplemented_method( "MyService", "streamByIdWithException", ), )) } async fn streamByIdWithResponse( &self, _request_context: &Self::RequestContext, _id: ::std::primitive::i64, ) -> ::std::result::Result<( crate::types::MyDataItem, ::futures::stream::BoxStream<'static, ::std::result::Result> ) , crate::services::my_service::StreamByIdWithResponseExn> { ::std::result::Result::Err(crate::services::my_service::StreamByIdWithResponseExn::ApplicationException( ::fbthrift::ApplicationException::unimplemented_method( "MyService", "streamByIdWithResponse", ), )) } fn createMyInteraction( &self, ) -> ::anyhow::Result<::std::boxed::Box> { ::anyhow::bail!("MyService.createMyInteraction not implemented"); } async fn startPingInteraction( &self, _request_context: &Self::RequestContext, ) -> ::std::result::Result<::std::boxed::Box, crate::services::my_service::StartPingInteractionExn> { ::std::result::Result::Err(crate::services::my_service::StartPingInteractionExn::ApplicationException( ::fbthrift::ApplicationException::unimplemented_method( "MyService", "startPingInteraction", ), )) } } #[::async_trait::async_trait] impl MyService for ::std::boxed::Box where T: MyService + Send + Sync + ?Sized, { type RequestContext = T::RequestContext; async fn ping( &self, request_context: &Self::RequestContext, ) -> ::std::result::Result<(), crate::services::my_service::PingExn> { (**self).ping( request_context, ).await } async fn getRandomData( &self, request_context: &Self::RequestContext, ) -> ::std::result::Result<::std::string::String, crate::services::my_service::GetRandomDataExn> { (**self).getRandomData( request_context, ).await } async fn hasDataById( &self, request_context: &Self::RequestContext, id: ::std::primitive::i64, ) -> ::std::result::Result<::std::primitive::bool, crate::services::my_service::HasDataByIdExn> { (**self).hasDataById( request_context, id, ).await } async fn getDataById( &self, request_context: &Self::RequestContext, id: ::std::primitive::i64, ) -> ::std::result::Result<::std::string::String, crate::services::my_service::GetDataByIdExn> { (**self).getDataById( request_context, id, ).await } async fn putDataById( &self, request_context: &Self::RequestContext, id: ::std::primitive::i64, data: ::std::string::String, ) -> ::std::result::Result<(), crate::services::my_service::PutDataByIdExn> { (**self).putDataById( request_context, id, data, ).await } async fn lobDataById( &self, request_context: &Self::RequestContext, id: ::std::primitive::i64, data: ::std::string::String, ) -> ::std::result::Result<(), crate::services::my_service::LobDataByIdExn> { (**self).lobDataById( request_context, id, data, ).await } async fn streamById( &self, request_context: &Self::RequestContext, id: ::std::primitive::i64, ) -> ::std::result::Result< ::futures::stream::BoxStream<'static, ::std::result::Result> , crate::services::my_service::StreamByIdExn> { (**self).streamById( request_context, id, ).await } async fn streamByIdWithException( &self, request_context: &Self::RequestContext, id: ::std::primitive::i64, ) -> ::std::result::Result< ::futures::stream::BoxStream<'static, ::std::result::Result> , crate::services::my_service::StreamByIdWithExceptionExn> { (**self).streamByIdWithException( request_context, id, ).await } async fn streamByIdWithResponse( &self, request_context: &Self::RequestContext, id: ::std::primitive::i64, ) -> ::std::result::Result<( crate::types::MyDataItem, ::futures::stream::BoxStream<'static, ::std::result::Result> ) , crate::services::my_service::StreamByIdWithResponseExn> { (**self).streamByIdWithResponse( request_context, id, ).await } fn createMyInteraction( &self, ) -> ::anyhow::Result<::std::boxed::Box> { (**self).createMyInteraction() } async fn startPingInteraction( &self, request_context: &Self::RequestContext, ) -> ::std::result::Result<::std::boxed::Box, crate::services::my_service::StartPingInteractionExn> { (**self).startPingInteraction( request_context, ).await } } #[::async_trait::async_trait] impl MyService for ::std::sync::Arc where T: MyService + Send + Sync + ?Sized, { type RequestContext = T::RequestContext; async fn ping( &self, request_context: &Self::RequestContext, ) -> ::std::result::Result<(), crate::services::my_service::PingExn> { (**self).ping( request_context, ).await } async fn getRandomData( &self, request_context: &Self::RequestContext, ) -> ::std::result::Result<::std::string::String, crate::services::my_service::GetRandomDataExn> { (**self).getRandomData( request_context, ).await } async fn hasDataById( &self, request_context: &Self::RequestContext, id: ::std::primitive::i64, ) -> ::std::result::Result<::std::primitive::bool, crate::services::my_service::HasDataByIdExn> { (**self).hasDataById( request_context, id, ).await } async fn getDataById( &self, request_context: &Self::RequestContext, id: ::std::primitive::i64, ) -> ::std::result::Result<::std::string::String, crate::services::my_service::GetDataByIdExn> { (**self).getDataById( request_context, id, ).await } async fn putDataById( &self, request_context: &Self::RequestContext, id: ::std::primitive::i64, data: ::std::string::String, ) -> ::std::result::Result<(), crate::services::my_service::PutDataByIdExn> { (**self).putDataById( request_context, id, data, ).await } async fn lobDataById( &self, request_context: &Self::RequestContext, id: ::std::primitive::i64, data: ::std::string::String, ) -> ::std::result::Result<(), crate::services::my_service::LobDataByIdExn> { (**self).lobDataById( request_context, id, data, ).await } async fn streamById( &self, request_context: &Self::RequestContext, id: ::std::primitive::i64, ) -> ::std::result::Result< ::futures::stream::BoxStream<'static, ::std::result::Result> , crate::services::my_service::StreamByIdExn> { (**self).streamById( request_context, id, ).await } async fn streamByIdWithException( &self, request_context: &Self::RequestContext, id: ::std::primitive::i64, ) -> ::std::result::Result< ::futures::stream::BoxStream<'static, ::std::result::Result> , crate::services::my_service::StreamByIdWithExceptionExn> { (**self).streamByIdWithException( request_context, id, ).await } async fn streamByIdWithResponse( &self, request_context: &Self::RequestContext, id: ::std::primitive::i64, ) -> ::std::result::Result<( crate::types::MyDataItem, ::futures::stream::BoxStream<'static, ::std::result::Result> ) , crate::services::my_service::StreamByIdWithResponseExn> { (**self).streamByIdWithResponse( request_context, id, ).await } fn createMyInteraction( &self, ) -> ::anyhow::Result<::std::boxed::Box> { (**self).createMyInteraction() } async fn startPingInteraction( &self, request_context: &Self::RequestContext, ) -> ::std::result::Result<::std::boxed::Box, crate::services::my_service::StartPingInteractionExn> { (**self).startPingInteraction( request_context, ).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_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_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_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_streamById { id: ::std::primitive::i64, } impl ::fbthrift::Deserialize

for self::Args_MyService_streamById { #[inline] #[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "MyService.streamById"))] 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.streamById", "id"))?, }) } } struct Args_MyService_streamByIdWithException { id: ::std::primitive::i64, } impl ::fbthrift::Deserialize

for self::Args_MyService_streamByIdWithException { #[inline] #[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "MyService.streamByIdWithException"))] 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.streamByIdWithException", "id"))?, }) } } struct Args_MyService_streamByIdWithResponse { id: ::std::primitive::i64, } impl ::fbthrift::Deserialize

for self::Args_MyService_streamByIdWithResponse { #[inline] #[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "MyService.streamByIdWithResponse"))] 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.streamByIdWithResponse", "id"))?, }) } } struct Args_MyService_startPingInteraction { } impl ::fbthrift::Deserialize

for self::Args_MyService_startPingInteraction { #[inline] #[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "MyService.startPingInteraction"))] 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 ::const_cstr::const_cstr; use ::futures::FutureExt as _; const_cstr! { SERVICE_NAME = "MyService"; METHOD_NAME = "ping"; SERVICE_METHOD_NAME = "MyService.ping"; } let mut ctx_stack = req_ctxt.get_context_stack( SERVICE_NAME.as_cstr(), SERVICE_METHOD_NAME.as_cstr(), )?; ::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.as_cstr(), buffer: req, })?; ::fbthrift::ContextStack::post_read(&mut ctx_stack, bytes_read)?; let res = ::std::panic::AssertUnwindSafe( self.service.ping( req_ctxt, ) ) .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::info!(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.as_cstr(), _seqid, req_ctxt, &mut ctx_stack, res, )?; reply_state.send_reply(env); 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 ::const_cstr::const_cstr; use ::futures::FutureExt as _; const_cstr! { SERVICE_NAME = "MyService"; METHOD_NAME = "getRandomData"; SERVICE_METHOD_NAME = "MyService.getRandomData"; } let mut ctx_stack = req_ctxt.get_context_stack( SERVICE_NAME.as_cstr(), SERVICE_METHOD_NAME.as_cstr(), )?; ::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.as_cstr(), buffer: req, })?; ::fbthrift::ContextStack::post_read(&mut ctx_stack, bytes_read)?; let res = ::std::panic::AssertUnwindSafe( self.service.getRandomData( req_ctxt, ) ) .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::info!(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.as_cstr(), _seqid, req_ctxt, &mut ctx_stack, res, )?; reply_state.send_reply(env); 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 ::const_cstr::const_cstr; use ::futures::FutureExt as _; const_cstr! { SERVICE_NAME = "MyService"; METHOD_NAME = "hasDataById"; SERVICE_METHOD_NAME = "MyService.hasDataById"; } let mut ctx_stack = req_ctxt.get_context_stack( SERVICE_NAME.as_cstr(), SERVICE_METHOD_NAME.as_cstr(), )?; ::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.as_cstr(), buffer: req, })?; ::fbthrift::ContextStack::post_read(&mut ctx_stack, bytes_read)?; let res = ::std::panic::AssertUnwindSafe( self.service.hasDataById( req_ctxt, _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::info!(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.as_cstr(), _seqid, req_ctxt, &mut ctx_stack, res, )?; reply_state.send_reply(env); 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 ::const_cstr::const_cstr; use ::futures::FutureExt as _; const_cstr! { SERVICE_NAME = "MyService"; METHOD_NAME = "getDataById"; SERVICE_METHOD_NAME = "MyService.getDataById"; } let mut ctx_stack = req_ctxt.get_context_stack( SERVICE_NAME.as_cstr(), SERVICE_METHOD_NAME.as_cstr(), )?; ::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.as_cstr(), buffer: req, })?; ::fbthrift::ContextStack::post_read(&mut ctx_stack, bytes_read)?; let res = ::std::panic::AssertUnwindSafe( self.service.getDataById( req_ctxt, _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::info!(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.as_cstr(), _seqid, req_ctxt, &mut ctx_stack, res, )?; reply_state.send_reply(env); 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 ::const_cstr::const_cstr; use ::futures::FutureExt as _; const_cstr! { SERVICE_NAME = "MyService"; METHOD_NAME = "putDataById"; SERVICE_METHOD_NAME = "MyService.putDataById"; } let mut ctx_stack = req_ctxt.get_context_stack( SERVICE_NAME.as_cstr(), SERVICE_METHOD_NAME.as_cstr(), )?; ::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.as_cstr(), buffer: req, })?; ::fbthrift::ContextStack::post_read(&mut ctx_stack, bytes_read)?; let res = ::std::panic::AssertUnwindSafe( self.service.putDataById( req_ctxt, _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::info!(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.as_cstr(), _seqid, req_ctxt, &mut ctx_stack, res, )?; reply_state.send_reply(env); 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 ::const_cstr::const_cstr; use ::futures::FutureExt as _; const_cstr! { SERVICE_NAME = "MyService"; METHOD_NAME = "lobDataById"; SERVICE_METHOD_NAME = "MyService.lobDataById"; } let mut ctx_stack = req_ctxt.get_context_stack( SERVICE_NAME.as_cstr(), SERVICE_METHOD_NAME.as_cstr(), )?; ::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.as_cstr(), buffer: req, })?; ::fbthrift::ContextStack::post_read(&mut ctx_stack, bytes_read)?; let res = ::std::panic::AssertUnwindSafe( self.service.lobDataById( req_ctxt, _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::info!(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.as_cstr(), _seqid, req_ctxt, &mut ctx_stack, res, )?; reply_state.send_reply(env); Ok(()) } #[::tracing::instrument(skip_all, name = "handler", fields(method = "MyService.streamById"))] async fn handle_streamById<'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 ::const_cstr::const_cstr; use ::futures::FutureExt as _; const_cstr! { SERVICE_NAME = "MyService"; METHOD_NAME = "streamById"; SERVICE_METHOD_NAME = "MyService.streamById"; } let mut ctx_stack = req_ctxt.get_context_stack( SERVICE_NAME.as_cstr(), SERVICE_METHOD_NAME.as_cstr(), )?; ::fbthrift::ContextStack::pre_read(&mut ctx_stack)?; let _args: self::Args_MyService_streamById = ::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.as_cstr(), buffer: req, })?; ::fbthrift::ContextStack::post_read(&mut ctx_stack, bytes_read)?; let res = ::std::panic::AssertUnwindSafe( self.service.streamById( req_ctxt, _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.streamById", "success"); ::std::result::Result::Ok(res) } ::std::result::Result::Ok(::std::result::Result::Err(exn)) => { ::std::result::Result::Err(exn) } ::std::result::Result::Err(exn) => { let aexn = ::fbthrift::ApplicationException::handler_panic("MyService.streamById", exn); ::tracing::error!(method = "MyService.streamById", panic = ?aexn); ::std::result::Result::Err(crate::services::my_service::StreamByIdExn::ApplicationException(aexn)) } }; use ::futures::StreamExt as _; let (response, stream) = match res { ::std::result::Result::Ok(res) => { let response = ::std::result::Result::Ok(()); let stream = res; let stream = ::std::panic::AssertUnwindSafe(stream) .catch_unwind() .map(|item| { match item { ::std::result::Result::Ok(::std::result::Result::Ok(success)) => { let payload = ::fbthrift::help::serialize_stream_item::( ::std::result::Result::Ok(success), ); ::fbthrift::SerializedStreamElement::Success(payload) } ::std::result::Result::Ok(::std::result::Result::Err(crate::services::my_service::StreamByIdStreamExn::ApplicationException(aexn))) => { tracing::info!(?aexn, method="MyService.streamById", "Streaming ApplicationException"); ::fbthrift::SerializedStreamElement::ApplicationException(aexn) } ::std::result::Result::Err(exn) => { tracing::error!(?exn, method="MyService.streamById", "Streaming unwind"); let aexn = ::fbthrift::ApplicationException::handler_panic("MyService.streamById", exn); ::fbthrift::SerializedStreamElement::ApplicationException(aexn) } } }) .boxed(); (response, Some(stream)) }, ::std::result::Result::Err(exn) => (::std::result::Result::Err(exn), None), }; let response = ::fbthrift::help::serialize_result_envelope::( "streamById", METHOD_NAME.as_cstr(), _seqid, req_ctxt, &mut ctx_stack, response, )?; let _ = reply_state.send_stream_reply(response, stream, P::PROTOCOL_ID); Ok(()) } #[::tracing::instrument(skip_all, name = "handler", fields(method = "MyService.streamByIdWithException"))] async fn handle_streamByIdWithException<'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 ::const_cstr::const_cstr; use ::futures::FutureExt as _; const_cstr! { SERVICE_NAME = "MyService"; METHOD_NAME = "streamByIdWithException"; SERVICE_METHOD_NAME = "MyService.streamByIdWithException"; } let mut ctx_stack = req_ctxt.get_context_stack( SERVICE_NAME.as_cstr(), SERVICE_METHOD_NAME.as_cstr(), )?; ::fbthrift::ContextStack::pre_read(&mut ctx_stack)?; let _args: self::Args_MyService_streamByIdWithException = ::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.as_cstr(), buffer: req, })?; ::fbthrift::ContextStack::post_read(&mut ctx_stack, bytes_read)?; let res = ::std::panic::AssertUnwindSafe( self.service.streamByIdWithException( req_ctxt, _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.streamByIdWithException", "success"); ::std::result::Result::Ok(res) } ::std::result::Result::Ok(::std::result::Result::Err(exn)) => { ::std::result::Result::Err(exn) } ::std::result::Result::Err(exn) => { let aexn = ::fbthrift::ApplicationException::handler_panic("MyService.streamByIdWithException", exn); ::tracing::error!(method = "MyService.streamByIdWithException", panic = ?aexn); ::std::result::Result::Err(crate::services::my_service::StreamByIdWithExceptionExn::ApplicationException(aexn)) } }; use ::futures::StreamExt as _; let (response, stream) = match res { ::std::result::Result::Ok(res) => { let response = ::std::result::Result::Ok(()); let stream = res; let stream = ::std::panic::AssertUnwindSafe(stream) .catch_unwind() .map(|item| { match item { ::std::result::Result::Ok(::std::result::Result::Ok(success)) => { let payload = ::fbthrift::help::serialize_stream_item::( ::std::result::Result::Ok(success), ); ::fbthrift::SerializedStreamElement::Success(payload) } ::std::result::Result::Ok(::std::result::Result::Err(crate::services::my_service::StreamByIdWithExceptionStreamExn::ApplicationException(aexn))) => { tracing::info!(?aexn, method="MyService.streamByIdWithException", "Streaming ApplicationException"); ::fbthrift::SerializedStreamElement::ApplicationException(aexn) } ::std::result::Result::Ok(::std::result::Result::Err(exn)) => { tracing::debug!(?exn, method="MyService.streamByIdWithException", "Streaming declared exception"); let payload = ::fbthrift::help::serialize_stream_item::( ::std::result::Result::Err(exn), ); ::fbthrift::SerializedStreamElement::DeclaredException(payload) } ::std::result::Result::Err(exn) => { tracing::error!(?exn, method="MyService.streamByIdWithException", "Streaming unwind"); let aexn = ::fbthrift::ApplicationException::handler_panic("MyService.streamByIdWithException", exn); ::fbthrift::SerializedStreamElement::ApplicationException(aexn) } } }) .boxed(); (response, Some(stream)) }, ::std::result::Result::Err(exn) => (::std::result::Result::Err(exn), None), }; let response = ::fbthrift::help::serialize_result_envelope::( "streamByIdWithException", METHOD_NAME.as_cstr(), _seqid, req_ctxt, &mut ctx_stack, response, )?; let _ = reply_state.send_stream_reply(response, stream, P::PROTOCOL_ID); Ok(()) } #[::tracing::instrument(skip_all, name = "handler", fields(method = "MyService.streamByIdWithResponse"))] async fn handle_streamByIdWithResponse<'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 ::const_cstr::const_cstr; use ::futures::FutureExt as _; const_cstr! { SERVICE_NAME = "MyService"; METHOD_NAME = "streamByIdWithResponse"; SERVICE_METHOD_NAME = "MyService.streamByIdWithResponse"; } let mut ctx_stack = req_ctxt.get_context_stack( SERVICE_NAME.as_cstr(), SERVICE_METHOD_NAME.as_cstr(), )?; ::fbthrift::ContextStack::pre_read(&mut ctx_stack)?; let _args: self::Args_MyService_streamByIdWithResponse = ::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.as_cstr(), buffer: req, })?; ::fbthrift::ContextStack::post_read(&mut ctx_stack, bytes_read)?; let res = ::std::panic::AssertUnwindSafe( self.service.streamByIdWithResponse( req_ctxt, _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.streamByIdWithResponse", "success"); ::std::result::Result::Ok(res) } ::std::result::Result::Ok(::std::result::Result::Err(exn)) => { ::std::result::Result::Err(exn) } ::std::result::Result::Err(exn) => { let aexn = ::fbthrift::ApplicationException::handler_panic("MyService.streamByIdWithResponse", exn); ::tracing::error!(method = "MyService.streamByIdWithResponse", panic = ?aexn); ::std::result::Result::Err(crate::services::my_service::StreamByIdWithResponseExn::ApplicationException(aexn)) } }; use ::futures::StreamExt as _; let (response, stream) = match res { ::std::result::Result::Ok(res) => { let (response, stream) = res; let response = ::std::result::Result::Ok(response); let stream = ::std::panic::AssertUnwindSafe(stream) .catch_unwind() .map(|item| { match item { ::std::result::Result::Ok(::std::result::Result::Ok(success)) => { let payload = ::fbthrift::help::serialize_stream_item::( ::std::result::Result::Ok(success), ); ::fbthrift::SerializedStreamElement::Success(payload) } ::std::result::Result::Ok(::std::result::Result::Err(crate::services::my_service::StreamByIdWithResponseStreamExn::ApplicationException(aexn))) => { tracing::info!(?aexn, method="MyService.streamByIdWithResponse", "Streaming ApplicationException"); ::fbthrift::SerializedStreamElement::ApplicationException(aexn) } ::std::result::Result::Err(exn) => { tracing::error!(?exn, method="MyService.streamByIdWithResponse", "Streaming unwind"); let aexn = ::fbthrift::ApplicationException::handler_panic("MyService.streamByIdWithResponse", exn); ::fbthrift::SerializedStreamElement::ApplicationException(aexn) } } }) .boxed(); (response, Some(stream)) }, ::std::result::Result::Err(exn) => (::std::result::Result::Err(exn), None), }; let response = ::fbthrift::help::serialize_result_envelope::( "streamByIdWithResponse", METHOD_NAME.as_cstr(), _seqid, req_ctxt, &mut ctx_stack, response, )?; let _ = reply_state.send_stream_reply(response, stream, P::PROTOCOL_ID); Ok(()) } fn handle_createMyInteraction( &self, ) -> ::anyhow::Result<::std::boxed::Box> { self.service.createMyInteraction() } #[::tracing::instrument(skip_all, name = "handler", fields(method = "MyService.startPingInteraction"))] async fn handle_startPingInteraction<'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 ::const_cstr::const_cstr; use ::futures::FutureExt as _; const_cstr! { SERVICE_NAME = "MyService"; METHOD_NAME = "startPingInteraction"; SERVICE_METHOD_NAME = "MyService.startPingInteraction"; } let mut ctx_stack = req_ctxt.get_context_stack( SERVICE_NAME.as_cstr(), SERVICE_METHOD_NAME.as_cstr(), )?; ::fbthrift::ContextStack::pre_read(&mut ctx_stack)?; let _args: self::Args_MyService_startPingInteraction = ::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.as_cstr(), buffer: req, })?; ::fbthrift::ContextStack::post_read(&mut ctx_stack, bytes_read)?; let res = ::std::panic::AssertUnwindSafe( self.service.startPingInteraction( req_ctxt, ) ) .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.startPingInteraction", "success"); let (interaction_handler, res) = (res, ()); let interaction_processor = ::std::sync::Arc::new(MyInteractionProcessor::, R, RS>::new(interaction_handler)); reply_state.set_interaction_processor(interaction_processor)?; ::std::result::Result::Ok(res) } ::std::result::Result::Ok(::std::result::Result::Err(exn)) => { ::tracing::info!(method = "MyService.startPingInteraction", exception = ?exn); ::std::result::Result::Err(exn) } ::std::result::Result::Err(exn) => { let aexn = ::fbthrift::ApplicationException::handler_panic("MyService.startPingInteraction", exn); ::tracing::error!(method = "MyService.startPingInteraction", panic = ?aexn); ::std::result::Result::Err(crate::services::my_service::StartPingInteractionExn::ApplicationException(aexn)) } }; let env = ::fbthrift::help::serialize_result_envelope::( "startPingInteraction", METHOD_NAME.as_cstr(), _seqid, req_ctxt, &mut ctx_stack, res, )?; reply_state.send_reply(env); 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"hasDataById" => ::std::result::Result::Ok(2usize), b"getDataById" => ::std::result::Result::Ok(3usize), b"putDataById" => ::std::result::Result::Ok(4usize), b"lobDataById" => ::std::result::Result::Ok(5usize), b"streamById" => ::std::result::Result::Ok(6usize), b"streamByIdWithException" => ::std::result::Result::Ok(7usize), b"streamByIdWithResponse" => ::std::result::Result::Ok(8usize), b"startPingInteraction" => ::std::result::Result::Ok(10usize), _ => ::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_hasDataById(_p, _req, _req_ctxt, _reply_state, _seqid).await } 3usize => { self.handle_getDataById(_p, _req, _req_ctxt, _reply_state, _seqid).await } 4usize => { self.handle_putDataById(_p, _req, _req_ctxt, _reply_state, _seqid).await } 5usize => { self.handle_lobDataById(_p, _req, _req_ctxt, _reply_state, _seqid).await } 6usize => { self.handle_streamById(_p, _req, _req_ctxt, _reply_state, _seqid).await } 7usize => { self.handle_streamByIdWithException(_p, _req, _req_ctxt, _reply_state, _seqid).await } 8usize => { self.handle_streamByIdWithResponse(_p, _req, _req_ctxt, _reply_state, _seqid).await } 10usize => { self.handle_startPingInteraction(_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: &str) -> ::anyhow::Result<::std::primitive::usize> { match name { "MyInteraction" => ::std::result::Result::Ok(9usize), _ => ::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 { 9usize => { let handler = self.handle_createMyInteraction()?; let server = ::std::sync::Arc::new(MyInteractionProcessor::, R, RS>::new(handler)); Ok(server) } 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()?; Ok(()) } fn create_interaction( &self, name: &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 str] { &[ // from MyService "ping", "getRandomData", "hasDataById", "getDataById", "putDataById", "lobDataById", "streamById", "streamByIdWithException", "streamByIdWithResponse", "startPingInteraction", "MyInteraction.ping", ] } 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)) } } }