// @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<T> MyInteraction for ::std::boxed::Box<T>
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<T> MyInteraction for ::std::sync::Arc<T>
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;
    }
}

struct Args_MyInteraction_ping {
}

impl<P: ::fbthrift::ProtocolReader> ::fbthrift::Deserialize<P> 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<Self> {
        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 {
        })
    }
}


pub mod my_service {
    use super::*;

    
    
    
    /// Processor for MyInteraction's methods.
    #[derive(Clone, Debug)]
    pub struct MyInteractionProcessor<P, H, R, RS> {
        service: H,
        supa: ::fbthrift::NullServiceProcessor<P, R, RS>,
        _phantom: ::std::marker::PhantomData<(P, H, R, RS)>,
    }
    
    impl<P, H, R, RS> MyInteractionProcessor<P, H, R, RS>
    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<Name = ::std::ffi::CStr> + ::std::marker::Send + ::std::marker::Sync + 'static,
        RS: ::fbthrift::ReplyState<P::Frame, RequestContext = R> + ::std::marker::Send + ::std::marker::Sync + 'static,
        <R as ::fbthrift::RequestContext>::ContextStack: ::fbthrift::ContextStack<Name = R::Name, Frame = <P as ::fbthrift::Protocol>::Frame>
            + ::std::marker::Send + ::std::marker::Sync,
        ::fbthrift::ProtocolDecoded<P>: ::std::clone::Clone,
        ::fbthrift::ProtocolEncodedFinal<P>: ::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<P>,
            req_ctxt: &R,
            reply_state: ::std::sync::Arc<RS>,
            _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"MyInteraction.ping";
            const SERVICE_METHOD_NAME: &::std::ffi::CStr = c"MyService.MyInteraction.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_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,
                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::error!(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::<P, R, crate::services::my_interaction::PingExn>(
                "ping",
                METHOD_NAME,
                _seqid,
                req_ctxt,
                &mut ctx_stack,
                res,
            )?;
            reply_state.send_reply(env);
            ::std::result::Result::Ok(())
        }
    }
    
    #[::async_trait::async_trait]
    impl<P, H, R, RS> ::fbthrift::ServiceProcessor<P> for MyInteractionProcessor<P, H, R, RS>
    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<Name = ::std::ffi::CStr> + ::std::marker::Send + ::std::marker::Sync + 'static,
        <R as ::fbthrift::RequestContext>::ContextStack: ::fbthrift::ContextStack<Name = R::Name, Frame = <P as ::fbthrift::Protocol>::Frame>
            + ::std::marker::Send + ::std::marker::Sync + 'static,
        RS: ::fbthrift::ReplyState<P::Frame, RequestContext = R> + ::std::marker::Send + ::std::marker::Sync + 'static,
        ::fbthrift::ProtocolDecoded<P>: ::std::clone::Clone,
        ::fbthrift::ProtocolEncodedFinal<P>: ::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<P>,
            _req_ctxt: &R,
            _reply_state: ::std::sync::Arc<RS>,
            _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: &::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<dyn ::fbthrift::ThriftService<P::Frame, Handler = (), RequestContext = Self::RequestContext, ReplyState = Self::ReplyState> + ::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<P, H, R, RS> ::fbthrift::ThriftService<P::Frame> for MyInteractionProcessor<P, H, R, RS>
    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<Name = ::std::ffi::CStr> + ::std::marker::Send + ::std::marker::Sync + 'static,
        <R as ::fbthrift::RequestContext>::ContextStack: ::fbthrift::ContextStack<Name = R::Name, Frame = <P as ::fbthrift::Protocol>::Frame>
            + ::std::marker::Send + ::std::marker::Sync + 'static,
        RS: ::fbthrift::ReplyState<P::Frame, RequestContext = R> + ::std::marker::Send + ::std::marker::Sync + 'static,
        ::fbthrift::ProtocolDecoded<P>: ::std::clone::Clone,
        ::fbthrift::ProtocolEncodedFinal<P>: ::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<P>,
            req_ctxt: &R,
            reply_state: ::std::sync::Arc<RS>,
        ) -> ::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<dyn ::fbthrift::ThriftService<P::Frame, Handler = (), RequestContext = R, ReplyState = RS> + ::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.MyInteraction:
            // 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::types::MyStruct, crate::services::my_service::StreamByIdStreamExn>>
, 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::types::MyStruct, crate::services::my_service::StreamByIdWithExceptionStreamExn>>
, 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::types::MyStruct, crate::services::my_service::StreamByIdWithResponseStreamExn>>
)
, 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<dyn MyInteraction>> {
        ::anyhow::bail!("MyService.createMyInteraction not implemented");
    }
    async fn startPingInteraction(
        &self,
        _request_context: &Self::RequestContext,
    ) -> ::std::result::Result<::std::boxed::Box<dyn MyInteraction>, 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<T> MyService for ::std::boxed::Box<T>
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::types::MyStruct, crate::services::my_service::StreamByIdStreamExn>>
, 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::types::MyStruct, crate::services::my_service::StreamByIdWithExceptionStreamExn>>
, 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::types::MyStruct, crate::services::my_service::StreamByIdWithResponseStreamExn>>
)
, crate::services::my_service::StreamByIdWithResponseExn> {
        (**self).streamByIdWithResponse(
            request_context,
            id,
        ).await
    }
    fn createMyInteraction(
        &self,
    ) -> ::anyhow::Result<::std::boxed::Box<dyn MyInteraction>> {
        (**self).createMyInteraction()
    }
    async fn startPingInteraction(
        &self,
        request_context: &Self::RequestContext,
    ) -> ::std::result::Result<::std::boxed::Box<dyn MyInteraction>, crate::services::my_service::StartPingInteractionExn> {
        (**self).startPingInteraction(
            request_context,
        ).await
    }
}

#[::async_trait::async_trait]
impl<T> MyService for ::std::sync::Arc<T>
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::types::MyStruct, crate::services::my_service::StreamByIdStreamExn>>
, 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::types::MyStruct, crate::services::my_service::StreamByIdWithExceptionStreamExn>>
, 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::types::MyStruct, crate::services::my_service::StreamByIdWithResponseStreamExn>>
)
, crate::services::my_service::StreamByIdWithResponseExn> {
        (**self).streamByIdWithResponse(
            request_context,
            id,
        ).await
    }
    fn createMyInteraction(
        &self,
    ) -> ::anyhow::Result<::std::boxed::Box<dyn MyInteraction>> {
        (**self).createMyInteraction()
    }
    async fn startPingInteraction(
        &self,
        request_context: &Self::RequestContext,
    ) -> ::std::result::Result<::std::boxed::Box<dyn MyInteraction>, crate::services::my_service::StartPingInteractionExn> {
        (**self).startPingInteraction(
            request_context,
        ).await
    }
}
/// Processor for MyService's methods.
#[derive(Clone, Debug)]
pub struct MyServiceProcessor<P, H, R, RS> {
    service: H,
    supa: ::fbthrift::NullServiceProcessor<P, R, RS>,
    _phantom: ::std::marker::PhantomData<(P, H, R, RS)>,
}


struct Args_MyService_ping {
}

impl<P: ::fbthrift::ProtocolReader> ::fbthrift::Deserialize<P> 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<Self> {
        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<P: ::fbthrift::ProtocolReader> ::fbthrift::Deserialize<P> 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<Self> {
        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<P: ::fbthrift::ProtocolReader> ::fbthrift::Deserialize<P> 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<Self> {
        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<P: ::fbthrift::ProtocolReader> ::fbthrift::Deserialize<P> 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<Self> {
        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<P: ::fbthrift::ProtocolReader> ::fbthrift::Deserialize<P> 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<Self> {
        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<P: ::fbthrift::ProtocolReader> ::fbthrift::Deserialize<P> 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<Self> {
        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<P: ::fbthrift::ProtocolReader> ::fbthrift::Deserialize<P> 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<Self> {
        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<P: ::fbthrift::ProtocolReader> ::fbthrift::Deserialize<P> 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<Self> {
        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<P: ::fbthrift::ProtocolReader> ::fbthrift::Deserialize<P> 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<Self> {
        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<P: ::fbthrift::ProtocolReader> ::fbthrift::Deserialize<P> 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<Self> {
        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<P, H, R, RS> MyServiceProcessor<P, H, R, RS>
where
    P: ::fbthrift::Protocol + ::std::marker::Send + ::std::marker::Sync + 'static,
    P::Frame: ::std::marker::Send + 'static,
    P::Deserializer: ::std::marker::Send,
    H: MyService<RequestContext = R>,
    R: ::fbthrift::RequestContext<Name = ::std::ffi::CStr> + ::std::marker::Send + ::std::marker::Sync + 'static,
    RS: ::fbthrift::ReplyState<P::Frame, RequestContext = R> + ::std::marker::Send + ::std::marker::Sync + 'static,
    <R as ::fbthrift::RequestContext>::ContextStack: ::fbthrift::ContextStack<Name = R::Name, Frame = <P as ::fbthrift::Protocol>::Frame>
        + ::std::marker::Send + ::std::marker::Sync,
    ::fbthrift::ProtocolDecoded<P>: ::std::clone::Clone,
    ::fbthrift::ProtocolEncodedFinal<P>: ::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<P>,
        req_ctxt: &R,
        reply_state: ::std::sync::Arc<RS>,
        _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(
                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::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::<P, R, crate::services::my_service::PingExn>(
            "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<P>,
        req_ctxt: &R,
        reply_state: ::std::sync::Arc<RS>,
        _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(
                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::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::<P, R, crate::services::my_service::GetRandomDataExn>(
            "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.hasDataById"))]
    async fn handle_hasDataById<'a>(
        &'a self,
        p: &'a mut P::Deserializer,
        req: ::fbthrift::ProtocolDecoded<P>,
        req_ctxt: &R,
        reply_state: ::std::sync::Arc<RS>,
        _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(
                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::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::<P, R, crate::services::my_service::HasDataByIdExn>(
            "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<P>,
        req_ctxt: &R,
        reply_state: ::std::sync::Arc<RS>,
        _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(
                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::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::<P, R, crate::services::my_service::GetDataByIdExn>(
            "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.putDataById"))]
    async fn handle_putDataById<'a>(
        &'a self,
        p: &'a mut P::Deserializer,
        req: ::fbthrift::ProtocolDecoded<P>,
        req_ctxt: &R,
        reply_state: ::std::sync::Arc<RS>,
        _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(
                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::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::<P, R, crate::services::my_service::PutDataByIdExn>(
            "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.lobDataById"))]
    async fn handle_lobDataById<'a>(
        &'a self,
        p: &'a mut P::Deserializer,
        req: ::fbthrift::ProtocolDecoded<P>,
        req_ctxt: &R,
        reply_state: ::std::sync::Arc<RS>,
        _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(
                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::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::<P, R, crate::services::my_service::LobDataByIdExn>(
            "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.streamById"))]
    async fn handle_streamById<'a>(
        &'a self,
        p: &'a mut P::Deserializer,
        req: ::fbthrift::ProtocolDecoded<P>,
        req_ctxt: &R,
        reply_state: ::std::sync::Arc<RS>,
        _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"streamById";
        const SERVICE_METHOD_NAME: &::std::ffi::CStr = c"MyService.streamById";
        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_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,
            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::<P, crate::services::my_service::StreamByIdStreamExn>(
                                    ::std::result::Result::Ok(success),
                                    "streamById",
                                );
                                ::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, ::std::option::Option::Some(stream))
            },
            ::std::result::Result::Err(exn) => (::std::result::Result::Err(exn), ::std::option::Option::None),
        };

        let response = ::fbthrift::help::serialize_result_envelope::<P, R, crate::services::my_service::StreamByIdExn>(
            "streamById",
            METHOD_NAME,
            _seqid,
            req_ctxt,
            &mut ctx_stack,
            response,
        )?;

        let _ = reply_state.send_stream_reply(response, stream, P::PROTOCOL_ID);
        ::std::result::Result::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<P>,
        req_ctxt: &R,
        reply_state: ::std::sync::Arc<RS>,
        _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"streamByIdWithException";
        const SERVICE_METHOD_NAME: &::std::ffi::CStr = c"MyService.streamByIdWithException";
        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_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,
            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::<P, crate::services::my_service::StreamByIdWithExceptionStreamExn>(
                                    ::std::result::Result::Ok(success),
                                    "streamByIdWithException",
                                );
                                ::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::<P, crate::services::my_service::StreamByIdWithExceptionStreamExn>(
                                    ::std::result::Result::Err(exn),
                                    "streamByIdWithException",
                                );
                                ::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, ::std::option::Option::Some(stream))
            },
            ::std::result::Result::Err(exn) => (::std::result::Result::Err(exn), ::std::option::Option::None),
        };

        let response = ::fbthrift::help::serialize_result_envelope::<P, R, crate::services::my_service::StreamByIdWithExceptionExn>(
            "streamByIdWithException",
            METHOD_NAME,
            _seqid,
            req_ctxt,
            &mut ctx_stack,
            response,
        )?;

        let _ = reply_state.send_stream_reply(response, stream, P::PROTOCOL_ID);
        ::std::result::Result::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<P>,
        req_ctxt: &R,
        reply_state: ::std::sync::Arc<RS>,
        _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"streamByIdWithResponse";
        const SERVICE_METHOD_NAME: &::std::ffi::CStr = c"MyService.streamByIdWithResponse";
        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_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,
            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::<P, crate::services::my_service::StreamByIdWithResponseStreamExn>(
                                    ::std::result::Result::Ok(success),
                                    "streamByIdWithResponse",
                                );
                                ::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, ::std::option::Option::Some(stream))
            },
            ::std::result::Result::Err(exn) => (::std::result::Result::Err(exn), ::std::option::Option::None),
        };

        let response = ::fbthrift::help::serialize_result_envelope::<P, R, crate::services::my_service::StreamByIdWithResponseExn>(
            "streamByIdWithResponse",
            METHOD_NAME,
            _seqid,
            req_ctxt,
            &mut ctx_stack,
            response,
        )?;

        let _ = reply_state.send_stream_reply(response, stream, P::PROTOCOL_ID);
        ::std::result::Result::Ok(())
    }

    fn handle_createMyInteraction(
        &self,
    ) -> ::anyhow::Result<::std::boxed::Box<dyn MyInteraction>> {
        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<P>,
        req_ctxt: &R,
        reply_state: ::std::sync::Arc<RS>,
        _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"startPingInteraction";
        const SERVICE_METHOD_NAME: &::std::ffi::CStr = c"MyService.startPingInteraction";
        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_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,
            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(crate::server::my_service::MyInteractionProcessor::<P, ::std::boxed::Box<dyn MyInteraction>, 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::error!(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::<P, R, crate::services::my_service::StartPingInteractionExn>(
            "startPingInteraction",
            METHOD_NAME,
            _seqid,
            req_ctxt,
            &mut ctx_stack,
            res,
        )?;
        reply_state.send_reply(env);
        ::std::result::Result::Ok(())
    }
}

#[::async_trait::async_trait]
impl<P, H, R, RS> ::fbthrift::ServiceProcessor<P> for MyServiceProcessor<P, H, R, RS>
where
    P: ::fbthrift::Protocol + ::std::marker::Send + ::std::marker::Sync + 'static,
    P::Deserializer: ::std::marker::Send,
    H: MyService<RequestContext = R>,
    P::Frame: ::std::marker::Send + 'static,
    R: ::fbthrift::RequestContext<Name = ::std::ffi::CStr> + ::std::marker::Send + ::std::marker::Sync + 'static,
    <R as ::fbthrift::RequestContext>::ContextStack: ::fbthrift::ContextStack<Name = R::Name, Frame = <P as ::fbthrift::Protocol>::Frame>
        + ::std::marker::Send + ::std::marker::Sync + 'static,
    RS: ::fbthrift::ReplyState<P::Frame, RequestContext = R> + ::std::marker::Send + ::std::marker::Sync + 'static,
    ::fbthrift::ProtocolDecoded<P>: ::std::clone::Clone,
    ::fbthrift::ProtocolEncodedFinal<P>: ::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<P>,
        _req_ctxt: &R,
        _reply_state: ::std::sync::Arc<RS>,
        _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: &::std::primitive::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<dyn ::fbthrift::ThriftService<P::Frame, Handler = (), RequestContext = Self::RequestContext, ReplyState = Self::ReplyState> + ::std::marker::Send + 'static>
    > {
        match idx {
            9usize => {
                let handler = self.handle_createMyInteraction()?;
                let server = ::std::sync::Arc::new(crate::server::my_service::MyInteractionProcessor::<P, ::std::boxed::Box<dyn MyInteraction>, R, RS>::new(handler));
                ::std::result::Result::Ok(server)
            }
            bad => panic!(
                "{}: unexpected method idx {}",
                "MyServiceProcessor",
                bad
            ),
        }
    }

    async fn handle_on_termination(&self) {
    }
}

#[::async_trait::async_trait]
impl<P, H, R, RS> ::fbthrift::ThriftService<P::Frame> for MyServiceProcessor<P, H, R, RS>
where
    P: ::fbthrift::Protocol + ::std::marker::Send + ::std::marker::Sync + 'static,
    P::Deserializer: ::std::marker::Send,
    P::Frame: ::std::marker::Send + 'static,
    H: MyService<RequestContext = R>,
    R: ::fbthrift::RequestContext<Name = ::std::ffi::CStr> + ::std::marker::Send + ::std::marker::Sync + 'static,
    <R as ::fbthrift::RequestContext>::ContextStack: ::fbthrift::ContextStack<Name = R::Name, Frame = <P as ::fbthrift::Protocol>::Frame>
        + ::std::marker::Send + ::std::marker::Sync + 'static,
    RS: ::fbthrift::ReplyState<P::Frame, RequestContext = R> + ::std::marker::Send + ::std::marker::Sync + 'static,
    ::fbthrift::ProtocolDecoded<P>: ::std::clone::Clone,
    ::fbthrift::ProtocolEncodedFinal<P>: ::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<P>,
        req_ctxt: &R,
        reply_state: ::std::sync::Arc<RS>,
    ) -> ::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<dyn ::fbthrift::ThriftService<P::Frame, Handler = (), RequestContext = R, ReplyState = RS> + ::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",
            "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<F, H, R, RS>(
    proto: ::fbthrift::ProtocolID,
    handler: H,
) -> ::std::result::Result<::std::boxed::Box<dyn ::fbthrift::ThriftService<F, Handler = H, RequestContext = R, ReplyState = RS> + ::std::marker::Send + 'static>, ::fbthrift::ApplicationException>
where
    F: ::fbthrift::Framing + ::std::marker::Send + ::std::marker::Sync + 'static,
    H: MyService<RequestContext = R>,
    R: ::fbthrift::RequestContext<Name = ::std::ffi::CStr> + ::std::marker::Send + ::std::marker::Sync + 'static,
    <R as ::fbthrift::RequestContext>::ContextStack: ::fbthrift::ContextStack<Name = R::Name, Frame = F> + ::std::marker::Send + ::std::marker::Sync + 'static,
    RS: ::fbthrift::ReplyState<F, RequestContext = R> + ::std::marker::Send + ::std::marker::Sync + 'static,
    ::fbthrift::FramingDecoded<F>: ::std::clone::Clone,
    ::fbthrift::FramingEncodedFinal<F>: ::std::clone::Clone + ::fbthrift::BufExt,
{
    match proto {
        ::fbthrift::ProtocolID::BinaryProtocol => {
            ::std::result::Result::Ok(::std::boxed::Box::new(MyServiceProcessor::<::fbthrift::BinaryProtocol<F>, H, R, RS>::new(handler)))
        }
        ::fbthrift::ProtocolID::CompactProtocol => {
            ::std::result::Result::Ok(::std::boxed::Box::new(MyServiceProcessor::<::fbthrift::CompactProtocol<F>, H, R, RS>::new(handler)))
        }
        bad => {
            ::tracing::error!(method = "MyService.", invalid_protocol = ?bad);
            ::std::result::Result::Err(::fbthrift::ApplicationException::invalid_protocol(bad))
        }
    }
}
