nebula_fbthrift_raftex_v2/
lib.rs

1// @generated by Thrift for src/interface/raftex.thrift
2// This file is probably not the place you want to edit!
3
4#![recursion_limit = "100000000"]
5#![allow(bare_trait_objects)]
6#![allow(non_camel_case_types, non_snake_case, non_upper_case_globals, unused_crate_dependencies, clippy::all)]
7
8pub use self::errors::*;
9pub use self::types::*;
10
11pub mod types;
12
13#[doc(hidden)]
14pub mod dependencies {
15}
16
17pub mod services {
18    pub mod raftex_service {
19        #[derive(Clone, Debug)]
20        pub enum AskForVoteExn {
21            #[doc(hidden)]
22            Success(crate::types::AskForVoteResponse),
23            ApplicationException(::fbthrift::ApplicationException),
24        }
25
26        impl ::std::convert::From<crate::errors::raftex_service::AskForVoteError> for AskForVoteExn {
27            fn from(err: crate::errors::raftex_service::AskForVoteError) -> Self {
28                match err {
29                    crate::errors::raftex_service::AskForVoteError::ApplicationException(aexn) => AskForVoteExn::ApplicationException(aexn),
30                    crate::errors::raftex_service::AskForVoteError::ThriftError(err) => AskForVoteExn::ApplicationException(::fbthrift::ApplicationException {
31                        message: err.to_string(),
32                        type_: ::fbthrift::ApplicationExceptionErrorCode::InternalError,
33                    }),
34                }
35            }
36        }
37
38        impl ::std::convert::From<::fbthrift::ApplicationException> for AskForVoteExn {
39            fn from(exn: ::fbthrift::ApplicationException) -> Self {
40                Self::ApplicationException(exn)
41            }
42        }
43
44        impl ::fbthrift::ExceptionInfo for AskForVoteExn {
45            fn exn_name(&self) -> &'static str {
46                match self {
47                    Self::Success(_) => panic!("ExceptionInfo::exn_name called on Success"),
48                    Self::ApplicationException(aexn) => aexn.exn_name(),
49                }
50            }
51
52            fn exn_value(&self) -> String {
53                match self {
54                    Self::Success(_) => panic!("ExceptionInfo::exn_value called on Success"),
55                    Self::ApplicationException(aexn) => aexn.exn_value(),
56                }
57            }
58
59            fn exn_is_declared(&self) -> bool {
60                match self {
61                    Self::Success(_) => panic!("ExceptionInfo::exn_is_declared called on Success"),
62                    Self::ApplicationException(aexn) => aexn.exn_is_declared(),
63                }
64            }
65        }
66
67        impl ::fbthrift::ResultInfo for AskForVoteExn {
68            fn result_type(&self) -> ::fbthrift::ResultType {
69                match self {
70                    Self::Success(_) => ::fbthrift::ResultType::Return,
71                    Self::ApplicationException(_aexn) => ::fbthrift::ResultType::Exception,
72                }
73            }
74        }
75
76        impl ::fbthrift::GetTType for AskForVoteExn {
77            const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
78        }
79
80        impl<P> ::fbthrift::Serialize<P> for AskForVoteExn
81        where
82            P: ::fbthrift::ProtocolWriter,
83        {
84            fn write(&self, p: &mut P) {
85                if let Self::ApplicationException(aexn) = self {
86                    return aexn.write(p);
87                }
88                p.write_struct_begin("AskForVote");
89                match self {
90                    Self::Success(inner) => {
91                        p.write_field_begin(
92                            "Success",
93                            ::fbthrift::TType::Struct,
94                            0i16,
95                        );
96                        inner.write(p);
97                        p.write_field_end();
98                    }
99                    Self::ApplicationException(_aexn) => unreachable!(),
100                }
101                p.write_field_stop();
102                p.write_struct_end();
103            }
104        }
105
106        impl<P> ::fbthrift::Deserialize<P> for AskForVoteExn
107        where
108            P: ::fbthrift::ProtocolReader,
109        {
110            fn read(p: &mut P) -> ::anyhow::Result<Self> {
111                static RETURNS: &[::fbthrift::Field] = &[
112                    ::fbthrift::Field::new("Success", ::fbthrift::TType::Struct, 0),
113                ];
114                let _ = p.read_struct_begin(|_| ())?;
115                let mut once = false;
116                let mut alt = ::std::option::Option::None;
117                loop {
118                    let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?;
119                    match ((fty, fid as ::std::primitive::i32), once) {
120                        ((::fbthrift::TType::Stop, _), _) => {
121                            p.read_field_end()?;
122                            break;
123                        }
124                        ((::fbthrift::TType::Struct, 0i32), false) => {
125                            once = true;
126                            alt = ::std::option::Option::Some(Self::Success(::fbthrift::Deserialize::read(p)?));
127                        }
128                        ((ty, _id), false) => p.skip(ty)?,
129                        ((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from(
130                            ::fbthrift::ApplicationException::new(
131                                ::fbthrift::ApplicationExceptionErrorCode::ProtocolError,
132                                format!(
133                                    "unwanted extra union {} field ty {:?} id {}",
134                                    "AskForVoteExn",
135                                    badty,
136                                    badid,
137                                ),
138                            )
139                        )),
140                    }
141                    p.read_field_end()?;
142                }
143                p.read_struct_end()?;
144                alt.ok_or_else(||
145                    ::fbthrift::ApplicationException::new(
146                        ::fbthrift::ApplicationExceptionErrorCode::MissingResult,
147                        format!("Empty union {}", "AskForVoteExn"),
148                    )
149                    .into(),
150                )
151            }
152        }
153
154        #[derive(Clone, Debug)]
155        pub enum AppendLogExn {
156            #[doc(hidden)]
157            Success(crate::types::AppendLogResponse),
158            ApplicationException(::fbthrift::ApplicationException),
159        }
160
161        impl ::std::convert::From<crate::errors::raftex_service::AppendLogError> for AppendLogExn {
162            fn from(err: crate::errors::raftex_service::AppendLogError) -> Self {
163                match err {
164                    crate::errors::raftex_service::AppendLogError::ApplicationException(aexn) => AppendLogExn::ApplicationException(aexn),
165                    crate::errors::raftex_service::AppendLogError::ThriftError(err) => AppendLogExn::ApplicationException(::fbthrift::ApplicationException {
166                        message: err.to_string(),
167                        type_: ::fbthrift::ApplicationExceptionErrorCode::InternalError,
168                    }),
169                }
170            }
171        }
172
173        impl ::std::convert::From<::fbthrift::ApplicationException> for AppendLogExn {
174            fn from(exn: ::fbthrift::ApplicationException) -> Self {
175                Self::ApplicationException(exn)
176            }
177        }
178
179        impl ::fbthrift::ExceptionInfo for AppendLogExn {
180            fn exn_name(&self) -> &'static str {
181                match self {
182                    Self::Success(_) => panic!("ExceptionInfo::exn_name called on Success"),
183                    Self::ApplicationException(aexn) => aexn.exn_name(),
184                }
185            }
186
187            fn exn_value(&self) -> String {
188                match self {
189                    Self::Success(_) => panic!("ExceptionInfo::exn_value called on Success"),
190                    Self::ApplicationException(aexn) => aexn.exn_value(),
191                }
192            }
193
194            fn exn_is_declared(&self) -> bool {
195                match self {
196                    Self::Success(_) => panic!("ExceptionInfo::exn_is_declared called on Success"),
197                    Self::ApplicationException(aexn) => aexn.exn_is_declared(),
198                }
199            }
200        }
201
202        impl ::fbthrift::ResultInfo for AppendLogExn {
203            fn result_type(&self) -> ::fbthrift::ResultType {
204                match self {
205                    Self::Success(_) => ::fbthrift::ResultType::Return,
206                    Self::ApplicationException(_aexn) => ::fbthrift::ResultType::Exception,
207                }
208            }
209        }
210
211        impl ::fbthrift::GetTType for AppendLogExn {
212            const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
213        }
214
215        impl<P> ::fbthrift::Serialize<P> for AppendLogExn
216        where
217            P: ::fbthrift::ProtocolWriter,
218        {
219            fn write(&self, p: &mut P) {
220                if let Self::ApplicationException(aexn) = self {
221                    return aexn.write(p);
222                }
223                p.write_struct_begin("AppendLog");
224                match self {
225                    Self::Success(inner) => {
226                        p.write_field_begin(
227                            "Success",
228                            ::fbthrift::TType::Struct,
229                            0i16,
230                        );
231                        inner.write(p);
232                        p.write_field_end();
233                    }
234                    Self::ApplicationException(_aexn) => unreachable!(),
235                }
236                p.write_field_stop();
237                p.write_struct_end();
238            }
239        }
240
241        impl<P> ::fbthrift::Deserialize<P> for AppendLogExn
242        where
243            P: ::fbthrift::ProtocolReader,
244        {
245            fn read(p: &mut P) -> ::anyhow::Result<Self> {
246                static RETURNS: &[::fbthrift::Field] = &[
247                    ::fbthrift::Field::new("Success", ::fbthrift::TType::Struct, 0),
248                ];
249                let _ = p.read_struct_begin(|_| ())?;
250                let mut once = false;
251                let mut alt = ::std::option::Option::None;
252                loop {
253                    let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?;
254                    match ((fty, fid as ::std::primitive::i32), once) {
255                        ((::fbthrift::TType::Stop, _), _) => {
256                            p.read_field_end()?;
257                            break;
258                        }
259                        ((::fbthrift::TType::Struct, 0i32), false) => {
260                            once = true;
261                            alt = ::std::option::Option::Some(Self::Success(::fbthrift::Deserialize::read(p)?));
262                        }
263                        ((ty, _id), false) => p.skip(ty)?,
264                        ((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from(
265                            ::fbthrift::ApplicationException::new(
266                                ::fbthrift::ApplicationExceptionErrorCode::ProtocolError,
267                                format!(
268                                    "unwanted extra union {} field ty {:?} id {}",
269                                    "AppendLogExn",
270                                    badty,
271                                    badid,
272                                ),
273                            )
274                        )),
275                    }
276                    p.read_field_end()?;
277                }
278                p.read_struct_end()?;
279                alt.ok_or_else(||
280                    ::fbthrift::ApplicationException::new(
281                        ::fbthrift::ApplicationExceptionErrorCode::MissingResult,
282                        format!("Empty union {}", "AppendLogExn"),
283                    )
284                    .into(),
285                )
286            }
287        }
288
289        #[derive(Clone, Debug)]
290        pub enum SendSnapshotExn {
291            #[doc(hidden)]
292            Success(crate::types::SendSnapshotResponse),
293            ApplicationException(::fbthrift::ApplicationException),
294        }
295
296        impl ::std::convert::From<crate::errors::raftex_service::SendSnapshotError> for SendSnapshotExn {
297            fn from(err: crate::errors::raftex_service::SendSnapshotError) -> Self {
298                match err {
299                    crate::errors::raftex_service::SendSnapshotError::ApplicationException(aexn) => SendSnapshotExn::ApplicationException(aexn),
300                    crate::errors::raftex_service::SendSnapshotError::ThriftError(err) => SendSnapshotExn::ApplicationException(::fbthrift::ApplicationException {
301                        message: err.to_string(),
302                        type_: ::fbthrift::ApplicationExceptionErrorCode::InternalError,
303                    }),
304                }
305            }
306        }
307
308        impl ::std::convert::From<::fbthrift::ApplicationException> for SendSnapshotExn {
309            fn from(exn: ::fbthrift::ApplicationException) -> Self {
310                Self::ApplicationException(exn)
311            }
312        }
313
314        impl ::fbthrift::ExceptionInfo for SendSnapshotExn {
315            fn exn_name(&self) -> &'static str {
316                match self {
317                    Self::Success(_) => panic!("ExceptionInfo::exn_name called on Success"),
318                    Self::ApplicationException(aexn) => aexn.exn_name(),
319                }
320            }
321
322            fn exn_value(&self) -> String {
323                match self {
324                    Self::Success(_) => panic!("ExceptionInfo::exn_value called on Success"),
325                    Self::ApplicationException(aexn) => aexn.exn_value(),
326                }
327            }
328
329            fn exn_is_declared(&self) -> bool {
330                match self {
331                    Self::Success(_) => panic!("ExceptionInfo::exn_is_declared called on Success"),
332                    Self::ApplicationException(aexn) => aexn.exn_is_declared(),
333                }
334            }
335        }
336
337        impl ::fbthrift::ResultInfo for SendSnapshotExn {
338            fn result_type(&self) -> ::fbthrift::ResultType {
339                match self {
340                    Self::Success(_) => ::fbthrift::ResultType::Return,
341                    Self::ApplicationException(_aexn) => ::fbthrift::ResultType::Exception,
342                }
343            }
344        }
345
346        impl ::fbthrift::GetTType for SendSnapshotExn {
347            const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
348        }
349
350        impl<P> ::fbthrift::Serialize<P> for SendSnapshotExn
351        where
352            P: ::fbthrift::ProtocolWriter,
353        {
354            fn write(&self, p: &mut P) {
355                if let Self::ApplicationException(aexn) = self {
356                    return aexn.write(p);
357                }
358                p.write_struct_begin("SendSnapshot");
359                match self {
360                    Self::Success(inner) => {
361                        p.write_field_begin(
362                            "Success",
363                            ::fbthrift::TType::Struct,
364                            0i16,
365                        );
366                        inner.write(p);
367                        p.write_field_end();
368                    }
369                    Self::ApplicationException(_aexn) => unreachable!(),
370                }
371                p.write_field_stop();
372                p.write_struct_end();
373            }
374        }
375
376        impl<P> ::fbthrift::Deserialize<P> for SendSnapshotExn
377        where
378            P: ::fbthrift::ProtocolReader,
379        {
380            fn read(p: &mut P) -> ::anyhow::Result<Self> {
381                static RETURNS: &[::fbthrift::Field] = &[
382                    ::fbthrift::Field::new("Success", ::fbthrift::TType::Struct, 0),
383                ];
384                let _ = p.read_struct_begin(|_| ())?;
385                let mut once = false;
386                let mut alt = ::std::option::Option::None;
387                loop {
388                    let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?;
389                    match ((fty, fid as ::std::primitive::i32), once) {
390                        ((::fbthrift::TType::Stop, _), _) => {
391                            p.read_field_end()?;
392                            break;
393                        }
394                        ((::fbthrift::TType::Struct, 0i32), false) => {
395                            once = true;
396                            alt = ::std::option::Option::Some(Self::Success(::fbthrift::Deserialize::read(p)?));
397                        }
398                        ((ty, _id), false) => p.skip(ty)?,
399                        ((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from(
400                            ::fbthrift::ApplicationException::new(
401                                ::fbthrift::ApplicationExceptionErrorCode::ProtocolError,
402                                format!(
403                                    "unwanted extra union {} field ty {:?} id {}",
404                                    "SendSnapshotExn",
405                                    badty,
406                                    badid,
407                                ),
408                            )
409                        )),
410                    }
411                    p.read_field_end()?;
412                }
413                p.read_struct_end()?;
414                alt.ok_or_else(||
415                    ::fbthrift::ApplicationException::new(
416                        ::fbthrift::ApplicationExceptionErrorCode::MissingResult,
417                        format!("Empty union {}", "SendSnapshotExn"),
418                    )
419                    .into(),
420                )
421            }
422        }
423
424        #[derive(Clone, Debug)]
425        pub enum HeartbeatExn {
426            #[doc(hidden)]
427            Success(crate::types::HeartbeatResponse),
428            ApplicationException(::fbthrift::ApplicationException),
429        }
430
431        impl ::std::convert::From<crate::errors::raftex_service::HeartbeatError> for HeartbeatExn {
432            fn from(err: crate::errors::raftex_service::HeartbeatError) -> Self {
433                match err {
434                    crate::errors::raftex_service::HeartbeatError::ApplicationException(aexn) => HeartbeatExn::ApplicationException(aexn),
435                    crate::errors::raftex_service::HeartbeatError::ThriftError(err) => HeartbeatExn::ApplicationException(::fbthrift::ApplicationException {
436                        message: err.to_string(),
437                        type_: ::fbthrift::ApplicationExceptionErrorCode::InternalError,
438                    }),
439                }
440            }
441        }
442
443        impl ::std::convert::From<::fbthrift::ApplicationException> for HeartbeatExn {
444            fn from(exn: ::fbthrift::ApplicationException) -> Self {
445                Self::ApplicationException(exn)
446            }
447        }
448
449        impl ::fbthrift::ExceptionInfo for HeartbeatExn {
450            fn exn_name(&self) -> &'static str {
451                match self {
452                    Self::Success(_) => panic!("ExceptionInfo::exn_name called on Success"),
453                    Self::ApplicationException(aexn) => aexn.exn_name(),
454                }
455            }
456
457            fn exn_value(&self) -> String {
458                match self {
459                    Self::Success(_) => panic!("ExceptionInfo::exn_value called on Success"),
460                    Self::ApplicationException(aexn) => aexn.exn_value(),
461                }
462            }
463
464            fn exn_is_declared(&self) -> bool {
465                match self {
466                    Self::Success(_) => panic!("ExceptionInfo::exn_is_declared called on Success"),
467                    Self::ApplicationException(aexn) => aexn.exn_is_declared(),
468                }
469            }
470        }
471
472        impl ::fbthrift::ResultInfo for HeartbeatExn {
473            fn result_type(&self) -> ::fbthrift::ResultType {
474                match self {
475                    Self::Success(_) => ::fbthrift::ResultType::Return,
476                    Self::ApplicationException(_aexn) => ::fbthrift::ResultType::Exception,
477                }
478            }
479        }
480
481        impl ::fbthrift::GetTType for HeartbeatExn {
482            const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
483        }
484
485        impl<P> ::fbthrift::Serialize<P> for HeartbeatExn
486        where
487            P: ::fbthrift::ProtocolWriter,
488        {
489            fn write(&self, p: &mut P) {
490                if let Self::ApplicationException(aexn) = self {
491                    return aexn.write(p);
492                }
493                p.write_struct_begin("Heartbeat");
494                match self {
495                    Self::Success(inner) => {
496                        p.write_field_begin(
497                            "Success",
498                            ::fbthrift::TType::Struct,
499                            0i16,
500                        );
501                        inner.write(p);
502                        p.write_field_end();
503                    }
504                    Self::ApplicationException(_aexn) => unreachable!(),
505                }
506                p.write_field_stop();
507                p.write_struct_end();
508            }
509        }
510
511        impl<P> ::fbthrift::Deserialize<P> for HeartbeatExn
512        where
513            P: ::fbthrift::ProtocolReader,
514        {
515            fn read(p: &mut P) -> ::anyhow::Result<Self> {
516                static RETURNS: &[::fbthrift::Field] = &[
517                    ::fbthrift::Field::new("Success", ::fbthrift::TType::Struct, 0),
518                ];
519                let _ = p.read_struct_begin(|_| ())?;
520                let mut once = false;
521                let mut alt = ::std::option::Option::None;
522                loop {
523                    let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?;
524                    match ((fty, fid as ::std::primitive::i32), once) {
525                        ((::fbthrift::TType::Stop, _), _) => {
526                            p.read_field_end()?;
527                            break;
528                        }
529                        ((::fbthrift::TType::Struct, 0i32), false) => {
530                            once = true;
531                            alt = ::std::option::Option::Some(Self::Success(::fbthrift::Deserialize::read(p)?));
532                        }
533                        ((ty, _id), false) => p.skip(ty)?,
534                        ((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from(
535                            ::fbthrift::ApplicationException::new(
536                                ::fbthrift::ApplicationExceptionErrorCode::ProtocolError,
537                                format!(
538                                    "unwanted extra union {} field ty {:?} id {}",
539                                    "HeartbeatExn",
540                                    badty,
541                                    badid,
542                                ),
543                            )
544                        )),
545                    }
546                    p.read_field_end()?;
547                }
548                p.read_struct_end()?;
549                alt.ok_or_else(||
550                    ::fbthrift::ApplicationException::new(
551                        ::fbthrift::ApplicationExceptionErrorCode::MissingResult,
552                        format!("Empty union {}", "HeartbeatExn"),
553                    )
554                    .into(),
555                )
556            }
557        }
558    }
559}
560
561/// Client implementation for each service in `raftex`.
562pub mod client {
563
564    pub struct RaftexServiceImpl<P, T, S = ::fbthrift::NoopSpawner> {
565        transport: T,
566        _phantom: ::std::marker::PhantomData<fn() -> (P, S)>,
567    }
568
569    impl<P, T, S> RaftexServiceImpl<P, T, S>
570    where
571        P: ::fbthrift::Protocol,
572        T: ::fbthrift::Transport,
573        P::Frame: ::fbthrift::Framing<DecBuf = ::fbthrift::FramingDecoded<T>>,
574        ::fbthrift::ProtocolEncoded<P>: ::fbthrift::BufMutExt<Final = ::fbthrift::FramingEncodedFinal<T>>,
575        P::Deserializer: ::std::marker::Send,
576        S: ::fbthrift::help::Spawner,
577    {
578        pub fn new(
579            transport: T,
580        ) -> Self {
581            Self {
582                transport,
583                _phantom: ::std::marker::PhantomData,
584            }
585        }
586
587        pub fn transport(&self) -> &T {
588            &self.transport
589        }
590
591
592        fn _askForVote_impl(
593            &self,
594            arg_req: &crate::types::AskForVoteRequest,
595            rpc_options: T::RpcOptions,
596        ) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::AskForVoteResponse, crate::errors::raftex_service::AskForVoteError>> {
597            use ::const_cstr::const_cstr;
598            use ::tracing::Instrument as _;
599            use ::futures::FutureExt as _;
600
601            const_cstr! {
602                SERVICE_NAME = "RaftexService";
603                METHOD_NAME = "RaftexService.askForVote";
604            }
605            let args = self::Args_RaftexService_askForVote {
606                req: arg_req,
607                _phantom: ::std::marker::PhantomData,
608            };
609
610            let transport = self.transport();
611
612            // need to do call setup outside of async block because T: Transport isn't Send
613            let request_env = match ::fbthrift::help::serialize_request_envelope::<P, _>("askForVote", &args) {
614                ::std::result::Result::Ok(res) => res,
615                ::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(),
616            };
617
618            let call = transport
619                .call(SERVICE_NAME.as_cstr(), METHOD_NAME.as_cstr(), request_env, rpc_options)
620                .instrument(::tracing::trace_span!("call", function = "RaftexService.askForVote"));
621
622            async move {
623                let reply_env = call.await?;
624
625                let de = P::deserializer(reply_env);
626                let (res, _de): (::std::result::Result<crate::services::raftex_service::AskForVoteExn, _>, _) =
627                    ::fbthrift::help::async_deserialize_response_envelope::<P, _, S>(de).await?;
628
629                let res = match res {
630                    ::std::result::Result::Ok(exn) => ::std::convert::From::from(exn),
631                    ::std::result::Result::Err(aexn) =>
632                        ::std::result::Result::Err(crate::errors::raftex_service::AskForVoteError::ApplicationException(aexn))
633                };
634                res
635            }
636            .instrument(::tracing::info_span!("RaftexService.askForVote"))
637            .boxed()
638        }
639
640        fn _appendLog_impl(
641            &self,
642            arg_req: &crate::types::AppendLogRequest,
643            rpc_options: T::RpcOptions,
644        ) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::AppendLogResponse, crate::errors::raftex_service::AppendLogError>> {
645            use ::const_cstr::const_cstr;
646            use ::tracing::Instrument as _;
647            use ::futures::FutureExt as _;
648
649            const_cstr! {
650                SERVICE_NAME = "RaftexService";
651                METHOD_NAME = "RaftexService.appendLog";
652            }
653            let args = self::Args_RaftexService_appendLog {
654                req: arg_req,
655                _phantom: ::std::marker::PhantomData,
656            };
657
658            let transport = self.transport();
659
660            // need to do call setup outside of async block because T: Transport isn't Send
661            let request_env = match ::fbthrift::help::serialize_request_envelope::<P, _>("appendLog", &args) {
662                ::std::result::Result::Ok(res) => res,
663                ::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(),
664            };
665
666            let call = transport
667                .call(SERVICE_NAME.as_cstr(), METHOD_NAME.as_cstr(), request_env, rpc_options)
668                .instrument(::tracing::trace_span!("call", function = "RaftexService.appendLog"));
669
670            async move {
671                let reply_env = call.await?;
672
673                let de = P::deserializer(reply_env);
674                let (res, _de): (::std::result::Result<crate::services::raftex_service::AppendLogExn, _>, _) =
675                    ::fbthrift::help::async_deserialize_response_envelope::<P, _, S>(de).await?;
676
677                let res = match res {
678                    ::std::result::Result::Ok(exn) => ::std::convert::From::from(exn),
679                    ::std::result::Result::Err(aexn) =>
680                        ::std::result::Result::Err(crate::errors::raftex_service::AppendLogError::ApplicationException(aexn))
681                };
682                res
683            }
684            .instrument(::tracing::info_span!("RaftexService.appendLog"))
685            .boxed()
686        }
687
688        fn _sendSnapshot_impl(
689            &self,
690            arg_req: &crate::types::SendSnapshotRequest,
691            rpc_options: T::RpcOptions,
692        ) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::SendSnapshotResponse, crate::errors::raftex_service::SendSnapshotError>> {
693            use ::const_cstr::const_cstr;
694            use ::tracing::Instrument as _;
695            use ::futures::FutureExt as _;
696
697            const_cstr! {
698                SERVICE_NAME = "RaftexService";
699                METHOD_NAME = "RaftexService.sendSnapshot";
700            }
701            let args = self::Args_RaftexService_sendSnapshot {
702                req: arg_req,
703                _phantom: ::std::marker::PhantomData,
704            };
705
706            let transport = self.transport();
707
708            // need to do call setup outside of async block because T: Transport isn't Send
709            let request_env = match ::fbthrift::help::serialize_request_envelope::<P, _>("sendSnapshot", &args) {
710                ::std::result::Result::Ok(res) => res,
711                ::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(),
712            };
713
714            let call = transport
715                .call(SERVICE_NAME.as_cstr(), METHOD_NAME.as_cstr(), request_env, rpc_options)
716                .instrument(::tracing::trace_span!("call", function = "RaftexService.sendSnapshot"));
717
718            async move {
719                let reply_env = call.await?;
720
721                let de = P::deserializer(reply_env);
722                let (res, _de): (::std::result::Result<crate::services::raftex_service::SendSnapshotExn, _>, _) =
723                    ::fbthrift::help::async_deserialize_response_envelope::<P, _, S>(de).await?;
724
725                let res = match res {
726                    ::std::result::Result::Ok(exn) => ::std::convert::From::from(exn),
727                    ::std::result::Result::Err(aexn) =>
728                        ::std::result::Result::Err(crate::errors::raftex_service::SendSnapshotError::ApplicationException(aexn))
729                };
730                res
731            }
732            .instrument(::tracing::info_span!("RaftexService.sendSnapshot"))
733            .boxed()
734        }
735
736        fn _heartbeat_impl(
737            &self,
738            arg_req: &crate::types::HeartbeatRequest,
739            rpc_options: T::RpcOptions,
740        ) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::HeartbeatResponse, crate::errors::raftex_service::HeartbeatError>> {
741            use ::const_cstr::const_cstr;
742            use ::tracing::Instrument as _;
743            use ::futures::FutureExt as _;
744
745            const_cstr! {
746                SERVICE_NAME = "RaftexService";
747                METHOD_NAME = "RaftexService.heartbeat";
748            }
749            let args = self::Args_RaftexService_heartbeat {
750                req: arg_req,
751                _phantom: ::std::marker::PhantomData,
752            };
753
754            let transport = self.transport();
755
756            // need to do call setup outside of async block because T: Transport isn't Send
757            let request_env = match ::fbthrift::help::serialize_request_envelope::<P, _>("heartbeat", &args) {
758                ::std::result::Result::Ok(res) => res,
759                ::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(),
760            };
761
762            let call = transport
763                .call(SERVICE_NAME.as_cstr(), METHOD_NAME.as_cstr(), request_env, rpc_options)
764                .instrument(::tracing::trace_span!("call", function = "RaftexService.heartbeat"));
765
766            async move {
767                let reply_env = call.await?;
768
769                let de = P::deserializer(reply_env);
770                let (res, _de): (::std::result::Result<crate::services::raftex_service::HeartbeatExn, _>, _) =
771                    ::fbthrift::help::async_deserialize_response_envelope::<P, _, S>(de).await?;
772
773                let res = match res {
774                    ::std::result::Result::Ok(exn) => ::std::convert::From::from(exn),
775                    ::std::result::Result::Err(aexn) =>
776                        ::std::result::Result::Err(crate::errors::raftex_service::HeartbeatError::ApplicationException(aexn))
777                };
778                res
779            }
780            .instrument(::tracing::info_span!("RaftexService.heartbeat"))
781            .boxed()
782        }
783    }
784
785    pub trait RaftexService: ::std::marker::Send {
786        fn askForVote(
787            &self,
788            arg_req: &crate::types::AskForVoteRequest,
789        ) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::AskForVoteResponse, crate::errors::raftex_service::AskForVoteError>>;
790
791        fn appendLog(
792            &self,
793            arg_req: &crate::types::AppendLogRequest,
794        ) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::AppendLogResponse, crate::errors::raftex_service::AppendLogError>>;
795
796        fn sendSnapshot(
797            &self,
798            arg_req: &crate::types::SendSnapshotRequest,
799        ) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::SendSnapshotResponse, crate::errors::raftex_service::SendSnapshotError>>;
800
801        fn heartbeat(
802            &self,
803            arg_req: &crate::types::HeartbeatRequest,
804        ) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::HeartbeatResponse, crate::errors::raftex_service::HeartbeatError>>;
805    }
806
807    pub trait RaftexServiceExt<T>: RaftexService
808    where
809        T: ::fbthrift::Transport,
810    {
811        fn askForVote_with_rpc_opts(
812            &self,
813            arg_req: &crate::types::AskForVoteRequest,
814            rpc_options: T::RpcOptions,
815        ) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::AskForVoteResponse, crate::errors::raftex_service::AskForVoteError>>;
816        fn appendLog_with_rpc_opts(
817            &self,
818            arg_req: &crate::types::AppendLogRequest,
819            rpc_options: T::RpcOptions,
820        ) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::AppendLogResponse, crate::errors::raftex_service::AppendLogError>>;
821        fn sendSnapshot_with_rpc_opts(
822            &self,
823            arg_req: &crate::types::SendSnapshotRequest,
824            rpc_options: T::RpcOptions,
825        ) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::SendSnapshotResponse, crate::errors::raftex_service::SendSnapshotError>>;
826        fn heartbeat_with_rpc_opts(
827            &self,
828            arg_req: &crate::types::HeartbeatRequest,
829            rpc_options: T::RpcOptions,
830        ) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::HeartbeatResponse, crate::errors::raftex_service::HeartbeatError>>;
831    }
832
833    struct Args_RaftexService_askForVote<'a> {
834        req: &'a crate::types::AskForVoteRequest,
835        _phantom: ::std::marker::PhantomData<&'a ()>,
836    }
837
838    impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize<P> for self::Args_RaftexService_askForVote<'a> {
839        #[inline]
840        #[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "RaftexService.askForVote"))]
841        fn write(&self, p: &mut P) {
842            p.write_struct_begin("args");
843            p.write_field_begin("req", ::fbthrift::TType::Struct, 1i16);
844            ::fbthrift::Serialize::write(&self.req, p);
845            p.write_field_end();
846            p.write_field_stop();
847            p.write_struct_end();
848        }
849    }
850
851    struct Args_RaftexService_appendLog<'a> {
852        req: &'a crate::types::AppendLogRequest,
853        _phantom: ::std::marker::PhantomData<&'a ()>,
854    }
855
856    impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize<P> for self::Args_RaftexService_appendLog<'a> {
857        #[inline]
858        #[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "RaftexService.appendLog"))]
859        fn write(&self, p: &mut P) {
860            p.write_struct_begin("args");
861            p.write_field_begin("req", ::fbthrift::TType::Struct, 1i16);
862            ::fbthrift::Serialize::write(&self.req, p);
863            p.write_field_end();
864            p.write_field_stop();
865            p.write_struct_end();
866        }
867    }
868
869    struct Args_RaftexService_sendSnapshot<'a> {
870        req: &'a crate::types::SendSnapshotRequest,
871        _phantom: ::std::marker::PhantomData<&'a ()>,
872    }
873
874    impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize<P> for self::Args_RaftexService_sendSnapshot<'a> {
875        #[inline]
876        #[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "RaftexService.sendSnapshot"))]
877        fn write(&self, p: &mut P) {
878            p.write_struct_begin("args");
879            p.write_field_begin("req", ::fbthrift::TType::Struct, 1i16);
880            ::fbthrift::Serialize::write(&self.req, p);
881            p.write_field_end();
882            p.write_field_stop();
883            p.write_struct_end();
884        }
885    }
886
887    struct Args_RaftexService_heartbeat<'a> {
888        req: &'a crate::types::HeartbeatRequest,
889        _phantom: ::std::marker::PhantomData<&'a ()>,
890    }
891
892    impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize<P> for self::Args_RaftexService_heartbeat<'a> {
893        #[inline]
894        #[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "RaftexService.heartbeat"))]
895        fn write(&self, p: &mut P) {
896            p.write_struct_begin("args");
897            p.write_field_begin("req", ::fbthrift::TType::Struct, 1i16);
898            ::fbthrift::Serialize::write(&self.req, p);
899            p.write_field_end();
900            p.write_field_stop();
901            p.write_struct_end();
902        }
903    }
904
905    impl<P, T, S> RaftexService for RaftexServiceImpl<P, T, S>
906    where
907        P: ::fbthrift::Protocol,
908        T: ::fbthrift::Transport,
909        P::Frame: ::fbthrift::Framing<DecBuf = ::fbthrift::FramingDecoded<T>>,
910        ::fbthrift::ProtocolEncoded<P>: ::fbthrift::BufMutExt<Final = ::fbthrift::FramingEncodedFinal<T>>,
911        P::Deserializer: ::std::marker::Send,
912        S: ::fbthrift::help::Spawner,
913    {
914        fn askForVote(
915            &self,
916            arg_req: &crate::types::AskForVoteRequest,
917        ) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::AskForVoteResponse, crate::errors::raftex_service::AskForVoteError>> {
918            let rpc_options = T::RpcOptions::default();
919            self._askForVote_impl(
920                arg_req,
921                rpc_options,
922            )
923        }
924        fn appendLog(
925            &self,
926            arg_req: &crate::types::AppendLogRequest,
927        ) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::AppendLogResponse, crate::errors::raftex_service::AppendLogError>> {
928            let rpc_options = T::RpcOptions::default();
929            self._appendLog_impl(
930                arg_req,
931                rpc_options,
932            )
933        }
934        fn sendSnapshot(
935            &self,
936            arg_req: &crate::types::SendSnapshotRequest,
937        ) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::SendSnapshotResponse, crate::errors::raftex_service::SendSnapshotError>> {
938            let rpc_options = T::RpcOptions::default();
939            self._sendSnapshot_impl(
940                arg_req,
941                rpc_options,
942            )
943        }
944        fn heartbeat(
945            &self,
946            arg_req: &crate::types::HeartbeatRequest,
947        ) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::HeartbeatResponse, crate::errors::raftex_service::HeartbeatError>> {
948            let rpc_options = T::RpcOptions::default();
949            self._heartbeat_impl(
950                arg_req,
951                rpc_options,
952            )
953        }
954    }
955
956    impl<P, T, S> RaftexServiceExt<T> for RaftexServiceImpl<P, T, S>
957    where
958        P: ::fbthrift::Protocol,
959        T: ::fbthrift::Transport,
960        P::Frame: ::fbthrift::Framing<DecBuf = ::fbthrift::FramingDecoded<T>>,
961        ::fbthrift::ProtocolEncoded<P>: ::fbthrift::BufMutExt<Final = ::fbthrift::FramingEncodedFinal<T>>,
962        P::Deserializer: ::std::marker::Send,
963        S: ::fbthrift::help::Spawner,
964    {
965        fn askForVote_with_rpc_opts(
966            &self,
967            arg_req: &crate::types::AskForVoteRequest,
968            rpc_options: T::RpcOptions,
969        ) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::AskForVoteResponse, crate::errors::raftex_service::AskForVoteError>> {
970            self._askForVote_impl(
971                arg_req,
972                rpc_options,
973            )
974        }
975        fn appendLog_with_rpc_opts(
976            &self,
977            arg_req: &crate::types::AppendLogRequest,
978            rpc_options: T::RpcOptions,
979        ) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::AppendLogResponse, crate::errors::raftex_service::AppendLogError>> {
980            self._appendLog_impl(
981                arg_req,
982                rpc_options,
983            )
984        }
985        fn sendSnapshot_with_rpc_opts(
986            &self,
987            arg_req: &crate::types::SendSnapshotRequest,
988            rpc_options: T::RpcOptions,
989        ) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::SendSnapshotResponse, crate::errors::raftex_service::SendSnapshotError>> {
990            self._sendSnapshot_impl(
991                arg_req,
992                rpc_options,
993            )
994        }
995        fn heartbeat_with_rpc_opts(
996            &self,
997            arg_req: &crate::types::HeartbeatRequest,
998            rpc_options: T::RpcOptions,
999        ) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::HeartbeatResponse, crate::errors::raftex_service::HeartbeatError>> {
1000            self._heartbeat_impl(
1001                arg_req,
1002                rpc_options,
1003            )
1004        }
1005    }
1006
1007    impl<'a, S> RaftexService for S
1008    where
1009        S: ::std::convert::AsRef<dyn RaftexService + 'a>,
1010        S: ::std::marker::Send,
1011    {
1012        fn askForVote(
1013            &self,
1014            arg_req: &crate::types::AskForVoteRequest,
1015        ) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::AskForVoteResponse, crate::errors::raftex_service::AskForVoteError>> {
1016            self.as_ref().askForVote(
1017                arg_req,
1018            )
1019        }
1020        fn appendLog(
1021            &self,
1022            arg_req: &crate::types::AppendLogRequest,
1023        ) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::AppendLogResponse, crate::errors::raftex_service::AppendLogError>> {
1024            self.as_ref().appendLog(
1025                arg_req,
1026            )
1027        }
1028        fn sendSnapshot(
1029            &self,
1030            arg_req: &crate::types::SendSnapshotRequest,
1031        ) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::SendSnapshotResponse, crate::errors::raftex_service::SendSnapshotError>> {
1032            self.as_ref().sendSnapshot(
1033                arg_req,
1034            )
1035        }
1036        fn heartbeat(
1037            &self,
1038            arg_req: &crate::types::HeartbeatRequest,
1039        ) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::HeartbeatResponse, crate::errors::raftex_service::HeartbeatError>> {
1040            self.as_ref().heartbeat(
1041                arg_req,
1042            )
1043        }
1044    }
1045
1046    impl<'a, S, T> RaftexServiceExt<T> for S
1047    where
1048        S: ::std::convert::AsRef<dyn RaftexService + 'a>,
1049        S: ::std::convert::AsRef<dyn RaftexServiceExt<T> + 'a>,
1050        S: ::std::marker::Send,
1051        T: ::fbthrift::Transport,
1052    {
1053        fn askForVote_with_rpc_opts(
1054            &self,
1055            arg_req: &crate::types::AskForVoteRequest,
1056            rpc_options: T::RpcOptions,
1057        ) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::AskForVoteResponse, crate::errors::raftex_service::AskForVoteError>> {
1058            <Self as ::std::convert::AsRef<dyn RaftexServiceExt<T>>>::as_ref(self).askForVote_with_rpc_opts(
1059                arg_req,
1060                rpc_options,
1061            )
1062        }
1063        fn appendLog_with_rpc_opts(
1064            &self,
1065            arg_req: &crate::types::AppendLogRequest,
1066            rpc_options: T::RpcOptions,
1067        ) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::AppendLogResponse, crate::errors::raftex_service::AppendLogError>> {
1068            <Self as ::std::convert::AsRef<dyn RaftexServiceExt<T>>>::as_ref(self).appendLog_with_rpc_opts(
1069                arg_req,
1070                rpc_options,
1071            )
1072        }
1073        fn sendSnapshot_with_rpc_opts(
1074            &self,
1075            arg_req: &crate::types::SendSnapshotRequest,
1076            rpc_options: T::RpcOptions,
1077        ) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::SendSnapshotResponse, crate::errors::raftex_service::SendSnapshotError>> {
1078            <Self as ::std::convert::AsRef<dyn RaftexServiceExt<T>>>::as_ref(self).sendSnapshot_with_rpc_opts(
1079                arg_req,
1080                rpc_options,
1081            )
1082        }
1083        fn heartbeat_with_rpc_opts(
1084            &self,
1085            arg_req: &crate::types::HeartbeatRequest,
1086            rpc_options: T::RpcOptions,
1087        ) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::HeartbeatResponse, crate::errors::raftex_service::HeartbeatError>> {
1088            <Self as ::std::convert::AsRef<dyn RaftexServiceExt<T>>>::as_ref(self).heartbeat_with_rpc_opts(
1089                arg_req,
1090                rpc_options,
1091            )
1092        }
1093    }
1094
1095    #[derive(Clone)]
1096    pub struct make_RaftexService;
1097
1098    /// To be called by user directly setting up a client. Avoids
1099    /// needing ClientFactory trait in scope, avoids unidiomatic
1100    /// make_Trait name.
1101    ///
1102    /// ```
1103    /// # const _: &str = stringify! {
1104    /// use bgs::client::BuckGraphService;
1105    ///
1106    /// let protocol = BinaryProtocol::new();
1107    /// let transport = HttpClient::new();
1108    /// let client = <dyn BuckGraphService>::new(protocol, transport);
1109    /// # };
1110    /// ```
1111    impl dyn RaftexService {
1112        pub fn new<P, T>(
1113            protocol: P,
1114            transport: T,
1115        ) -> ::std::sync::Arc<impl RaftexService + ::std::marker::Send + ::std::marker::Sync + 'static>
1116        where
1117            P: ::fbthrift::Protocol<Frame = T>,
1118            T: ::fbthrift::Transport,
1119            P::Deserializer: ::std::marker::Send,
1120        {
1121            let spawner = ::fbthrift::help::NoopSpawner;
1122            Self::with_spawner(protocol, transport, spawner)
1123        }
1124
1125        pub fn with_spawner<P, T, S>(
1126            protocol: P,
1127            transport: T,
1128            spawner: S,
1129        ) -> ::std::sync::Arc<impl RaftexService + ::std::marker::Send + ::std::marker::Sync + 'static>
1130        where
1131            P: ::fbthrift::Protocol<Frame = T>,
1132            T: ::fbthrift::Transport,
1133            P::Deserializer: ::std::marker::Send,
1134            S: ::fbthrift::help::Spawner,
1135        {
1136            let _ = protocol;
1137            let _ = spawner;
1138            ::std::sync::Arc::new(RaftexServiceImpl::<P, T, S>::new(transport))
1139        }
1140    }
1141
1142    impl<T> dyn RaftexServiceExt<T>
1143    where
1144        T: ::fbthrift::Transport,
1145    {
1146        pub fn new<P>(
1147            protocol: P,
1148            transport: T,
1149        ) -> ::std::sync::Arc<impl RaftexServiceExt<T> + ::std::marker::Send + ::std::marker::Sync + 'static>
1150        where
1151            P: ::fbthrift::Protocol<Frame = T>,
1152            P::Deserializer: ::std::marker::Send,
1153        {
1154            let spawner = ::fbthrift::help::NoopSpawner;
1155            Self::with_spawner(protocol, transport, spawner)
1156        }
1157
1158        pub fn with_spawner<P, S>(
1159            protocol: P,
1160            transport: T,
1161            spawner: S,
1162        ) -> ::std::sync::Arc<impl RaftexServiceExt<T> + ::std::marker::Send + ::std::marker::Sync + 'static>
1163        where
1164            P: ::fbthrift::Protocol<Frame = T>,
1165            P::Deserializer: ::std::marker::Send,
1166            S: ::fbthrift::help::Spawner,
1167        {
1168            let _ = protocol;
1169            let _ = spawner;
1170            ::std::sync::Arc::new(RaftexServiceImpl::<P, T, S>::new(transport))
1171        }
1172    }
1173
1174    pub type RaftexServiceDynClient = <make_RaftexService as ::fbthrift::ClientFactory>::Api;
1175    pub type RaftexServiceClient = ::std::sync::Arc<RaftexServiceDynClient>;
1176
1177    /// The same thing, but to be called from generic contexts where we are
1178    /// working with a type parameter `C: ClientFactory` to produce clients.
1179    impl ::fbthrift::ClientFactory for make_RaftexService {
1180        type Api = dyn RaftexService + ::std::marker::Send + ::std::marker::Sync + 'static;
1181
1182        fn with_spawner<P, T, S>(protocol: P, transport: T, spawner: S) -> ::std::sync::Arc<Self::Api>
1183        where
1184            P: ::fbthrift::Protocol<Frame = T>,
1185            T: ::fbthrift::Transport,
1186            P::Deserializer: ::std::marker::Send,
1187            S: ::fbthrift::help::Spawner,
1188        {
1189            <dyn RaftexService>::with_spawner(protocol, transport, spawner)
1190        }
1191    }
1192
1193}
1194
1195/// Server definitions for `raftex`.
1196pub mod server {
1197    #[::async_trait::async_trait]
1198    pub trait RaftexService: ::std::marker::Send + ::std::marker::Sync + 'static {
1199        async fn askForVote(
1200            &self,
1201            _req: crate::types::AskForVoteRequest,
1202        ) -> ::std::result::Result<crate::types::AskForVoteResponse, crate::services::raftex_service::AskForVoteExn> {
1203            ::std::result::Result::Err(crate::services::raftex_service::AskForVoteExn::ApplicationException(
1204                ::fbthrift::ApplicationException::unimplemented_method(
1205                    "RaftexService",
1206                    "askForVote",
1207                ),
1208            ))
1209        }
1210        async fn appendLog(
1211            &self,
1212            _req: crate::types::AppendLogRequest,
1213        ) -> ::std::result::Result<crate::types::AppendLogResponse, crate::services::raftex_service::AppendLogExn> {
1214            ::std::result::Result::Err(crate::services::raftex_service::AppendLogExn::ApplicationException(
1215                ::fbthrift::ApplicationException::unimplemented_method(
1216                    "RaftexService",
1217                    "appendLog",
1218                ),
1219            ))
1220        }
1221        async fn sendSnapshot(
1222            &self,
1223            _req: crate::types::SendSnapshotRequest,
1224        ) -> ::std::result::Result<crate::types::SendSnapshotResponse, crate::services::raftex_service::SendSnapshotExn> {
1225            ::std::result::Result::Err(crate::services::raftex_service::SendSnapshotExn::ApplicationException(
1226                ::fbthrift::ApplicationException::unimplemented_method(
1227                    "RaftexService",
1228                    "sendSnapshot",
1229                ),
1230            ))
1231        }
1232        async fn heartbeat(
1233            &self,
1234            _req: crate::types::HeartbeatRequest,
1235        ) -> ::std::result::Result<crate::types::HeartbeatResponse, crate::services::raftex_service::HeartbeatExn> {
1236            ::std::result::Result::Err(crate::services::raftex_service::HeartbeatExn::ApplicationException(
1237                ::fbthrift::ApplicationException::unimplemented_method(
1238                    "RaftexService",
1239                    "heartbeat",
1240                ),
1241            ))
1242        }
1243    }
1244
1245    #[::async_trait::async_trait]
1246    impl<T> RaftexService for ::std::boxed::Box<T>
1247    where
1248        T: RaftexService + Send + Sync + ?Sized,
1249    {
1250        async fn askForVote(
1251            &self,
1252            req: crate::types::AskForVoteRequest,
1253        ) -> ::std::result::Result<crate::types::AskForVoteResponse, crate::services::raftex_service::AskForVoteExn> {
1254            (**self).askForVote(
1255                req,
1256            ).await
1257        }
1258        async fn appendLog(
1259            &self,
1260            req: crate::types::AppendLogRequest,
1261        ) -> ::std::result::Result<crate::types::AppendLogResponse, crate::services::raftex_service::AppendLogExn> {
1262            (**self).appendLog(
1263                req,
1264            ).await
1265        }
1266        async fn sendSnapshot(
1267            &self,
1268            req: crate::types::SendSnapshotRequest,
1269        ) -> ::std::result::Result<crate::types::SendSnapshotResponse, crate::services::raftex_service::SendSnapshotExn> {
1270            (**self).sendSnapshot(
1271                req,
1272            ).await
1273        }
1274        async fn heartbeat(
1275            &self,
1276            req: crate::types::HeartbeatRequest,
1277        ) -> ::std::result::Result<crate::types::HeartbeatResponse, crate::services::raftex_service::HeartbeatExn> {
1278            (**self).heartbeat(
1279                req,
1280            ).await
1281        }
1282    }
1283
1284    /// Processor for RaftexService's methods.
1285    #[derive(Clone, Debug)]
1286    pub struct RaftexServiceProcessor<P, H, R, RS> {
1287        service: H,
1288        supa: ::fbthrift::NullServiceProcessor<P, R, RS>,
1289        _phantom: ::std::marker::PhantomData<(P, H, R, RS)>,
1290    }
1291
1292    struct Args_RaftexService_askForVote {
1293        req: crate::types::AskForVoteRequest,
1294    }
1295    impl<P: ::fbthrift::ProtocolReader> ::fbthrift::Deserialize<P> for self::Args_RaftexService_askForVote {
1296        #[inline]
1297        #[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "RaftexService.askForVote"))]
1298        fn read(p: &mut P) -> ::anyhow::Result<Self> {
1299            static ARGS: &[::fbthrift::Field] = &[
1300                ::fbthrift::Field::new("req", ::fbthrift::TType::Struct, 1),
1301            ];
1302            let mut field_req = ::std::option::Option::None;
1303            let _ = p.read_struct_begin(|_| ())?;
1304            loop {
1305                let (_, fty, fid) = p.read_field_begin(|_| (), ARGS)?;
1306                match (fty, fid as ::std::primitive::i32) {
1307                    (::fbthrift::TType::Stop, _) => break,
1308                    (::fbthrift::TType::Struct, 1) => field_req = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
1309                    (fty, _) => p.skip(fty)?,
1310                }
1311                p.read_field_end()?;
1312            }
1313            p.read_struct_end()?;
1314            ::std::result::Result::Ok(Self {
1315                req: field_req.ok_or_else(|| ::anyhow::anyhow!("`{}` missing arg `{}`", "RaftexService.askForVote", "req"))?,
1316            })
1317        }
1318    }
1319
1320    struct Args_RaftexService_appendLog {
1321        req: crate::types::AppendLogRequest,
1322    }
1323    impl<P: ::fbthrift::ProtocolReader> ::fbthrift::Deserialize<P> for self::Args_RaftexService_appendLog {
1324        #[inline]
1325        #[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "RaftexService.appendLog"))]
1326        fn read(p: &mut P) -> ::anyhow::Result<Self> {
1327            static ARGS: &[::fbthrift::Field] = &[
1328                ::fbthrift::Field::new("req", ::fbthrift::TType::Struct, 1),
1329            ];
1330            let mut field_req = ::std::option::Option::None;
1331            let _ = p.read_struct_begin(|_| ())?;
1332            loop {
1333                let (_, fty, fid) = p.read_field_begin(|_| (), ARGS)?;
1334                match (fty, fid as ::std::primitive::i32) {
1335                    (::fbthrift::TType::Stop, _) => break,
1336                    (::fbthrift::TType::Struct, 1) => field_req = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
1337                    (fty, _) => p.skip(fty)?,
1338                }
1339                p.read_field_end()?;
1340            }
1341            p.read_struct_end()?;
1342            ::std::result::Result::Ok(Self {
1343                req: field_req.ok_or_else(|| ::anyhow::anyhow!("`{}` missing arg `{}`", "RaftexService.appendLog", "req"))?,
1344            })
1345        }
1346    }
1347
1348    struct Args_RaftexService_sendSnapshot {
1349        req: crate::types::SendSnapshotRequest,
1350    }
1351    impl<P: ::fbthrift::ProtocolReader> ::fbthrift::Deserialize<P> for self::Args_RaftexService_sendSnapshot {
1352        #[inline]
1353        #[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "RaftexService.sendSnapshot"))]
1354        fn read(p: &mut P) -> ::anyhow::Result<Self> {
1355            static ARGS: &[::fbthrift::Field] = &[
1356                ::fbthrift::Field::new("req", ::fbthrift::TType::Struct, 1),
1357            ];
1358            let mut field_req = ::std::option::Option::None;
1359            let _ = p.read_struct_begin(|_| ())?;
1360            loop {
1361                let (_, fty, fid) = p.read_field_begin(|_| (), ARGS)?;
1362                match (fty, fid as ::std::primitive::i32) {
1363                    (::fbthrift::TType::Stop, _) => break,
1364                    (::fbthrift::TType::Struct, 1) => field_req = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
1365                    (fty, _) => p.skip(fty)?,
1366                }
1367                p.read_field_end()?;
1368            }
1369            p.read_struct_end()?;
1370            ::std::result::Result::Ok(Self {
1371                req: field_req.ok_or_else(|| ::anyhow::anyhow!("`{}` missing arg `{}`", "RaftexService.sendSnapshot", "req"))?,
1372            })
1373        }
1374    }
1375
1376    struct Args_RaftexService_heartbeat {
1377        req: crate::types::HeartbeatRequest,
1378    }
1379    impl<P: ::fbthrift::ProtocolReader> ::fbthrift::Deserialize<P> for self::Args_RaftexService_heartbeat {
1380        #[inline]
1381        #[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "RaftexService.heartbeat"))]
1382        fn read(p: &mut P) -> ::anyhow::Result<Self> {
1383            static ARGS: &[::fbthrift::Field] = &[
1384                ::fbthrift::Field::new("req", ::fbthrift::TType::Struct, 1),
1385            ];
1386            let mut field_req = ::std::option::Option::None;
1387            let _ = p.read_struct_begin(|_| ())?;
1388            loop {
1389                let (_, fty, fid) = p.read_field_begin(|_| (), ARGS)?;
1390                match (fty, fid as ::std::primitive::i32) {
1391                    (::fbthrift::TType::Stop, _) => break,
1392                    (::fbthrift::TType::Struct, 1) => field_req = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
1393                    (fty, _) => p.skip(fty)?,
1394                }
1395                p.read_field_end()?;
1396            }
1397            p.read_struct_end()?;
1398            ::std::result::Result::Ok(Self {
1399                req: field_req.ok_or_else(|| ::anyhow::anyhow!("`{}` missing arg `{}`", "RaftexService.heartbeat", "req"))?,
1400            })
1401        }
1402    }
1403
1404
1405    impl<P, H, R, RS> RaftexServiceProcessor<P, H, R, RS>
1406    where
1407        P: ::fbthrift::Protocol + ::std::marker::Send + ::std::marker::Sync + 'static,
1408        P::Frame: ::std::marker::Send + 'static,
1409        P::Deserializer: ::std::marker::Send,
1410        H: RaftexService,
1411        R: ::fbthrift::RequestContext<Name = ::std::ffi::CStr> + ::std::marker::Send + ::std::marker::Sync + 'static,
1412        RS: ::fbthrift::ReplyState<P::Frame, RequestContext = R> + ::std::marker::Send + ::std::marker::Sync + 'static,
1413        <R as ::fbthrift::RequestContext>::ContextStack: ::fbthrift::ContextStack<Name = R::Name, Buffer = ::fbthrift::ProtocolDecoded<P>>
1414            + ::std::marker::Send + ::std::marker::Sync,
1415    {
1416        pub fn new(service: H) -> Self {
1417            Self {
1418                service,
1419                supa: ::fbthrift::NullServiceProcessor::new(),
1420                _phantom: ::std::marker::PhantomData,
1421            }
1422        }
1423
1424        pub fn into_inner(self) -> H {
1425            self.service
1426        }
1427
1428        #[::tracing::instrument(skip_all, name = "handler", fields(method = "RaftexService.askForVote"))]
1429        async fn handle_askForVote<'a>(
1430            &'a self,
1431            p: &'a mut P::Deserializer,
1432            req_ctxt: &R,
1433            reply_state: ::std::sync::Arc<::std::sync::Mutex<RS>>,
1434            _seqid: ::std::primitive::u32,
1435        ) -> ::anyhow::Result<()> {
1436            use ::const_cstr::const_cstr;
1437            use ::futures::FutureExt as _;
1438
1439            const_cstr! {
1440                SERVICE_NAME = "RaftexService";
1441                METHOD_NAME = "RaftexService.askForVote";
1442            }
1443            let mut ctx_stack = req_ctxt.get_context_stack(
1444                SERVICE_NAME.as_cstr(),
1445                METHOD_NAME.as_cstr(),
1446            )?;
1447            ::fbthrift::ContextStack::pre_read(&mut ctx_stack)?;
1448            let _args: self::Args_RaftexService_askForVote = ::fbthrift::Deserialize::read(p)?;
1449            ::fbthrift::ContextStack::on_read_data(&mut ctx_stack, &::fbthrift::SerializedMessage {
1450                protocol: P::PROTOCOL_ID,
1451                method_name: METHOD_NAME.as_cstr(),
1452                buffer: ::std::marker::PhantomData, // FIXME P::into_buffer(p).reset(),
1453            })?;
1454            ::fbthrift::ContextStack::post_read(&mut ctx_stack, 0)?;
1455
1456            let res = ::std::panic::AssertUnwindSafe(
1457                self.service.askForVote(
1458                    _args.req,
1459                )
1460            )
1461            .catch_unwind()
1462            .await;
1463
1464            // nested results - panic catch on the outside, method on the inside
1465            let res = match res {
1466                ::std::result::Result::Ok(::std::result::Result::Ok(res)) => {
1467                    ::tracing::info!("success");
1468                    crate::services::raftex_service::AskForVoteExn::Success(res)
1469                }
1470                ::std::result::Result::Ok(::std::result::Result::Err(crate::services::raftex_service::AskForVoteExn::Success(_))) => {
1471                    panic!(
1472                        "{} attempted to return success via error",
1473                        "askForVote",
1474                    )
1475                }
1476                ::std::result::Result::Ok(::std::result::Result::Err(exn)) => {
1477                    ::tracing::error!(exception = ?exn);
1478                    exn
1479                }
1480                ::std::result::Result::Err(exn) => {
1481                    let aexn = ::fbthrift::ApplicationException::handler_panic("RaftexService.askForVote", exn);
1482                    crate::services::raftex_service::AskForVoteExn::ApplicationException(aexn)
1483                }
1484            };
1485
1486            let env = ::fbthrift::help::serialize_result_envelope::<P, R, _>(
1487                "askForVote",
1488                METHOD_NAME.as_cstr(),
1489                _seqid,
1490                req_ctxt,
1491                &mut ctx_stack,
1492                res
1493            )?;
1494            reply_state.lock().unwrap().send_reply(env);
1495            Ok(())
1496        }
1497
1498        #[::tracing::instrument(skip_all, name = "handler", fields(method = "RaftexService.appendLog"))]
1499        async fn handle_appendLog<'a>(
1500            &'a self,
1501            p: &'a mut P::Deserializer,
1502            req_ctxt: &R,
1503            reply_state: ::std::sync::Arc<::std::sync::Mutex<RS>>,
1504            _seqid: ::std::primitive::u32,
1505        ) -> ::anyhow::Result<()> {
1506            use ::const_cstr::const_cstr;
1507            use ::futures::FutureExt as _;
1508
1509            const_cstr! {
1510                SERVICE_NAME = "RaftexService";
1511                METHOD_NAME = "RaftexService.appendLog";
1512            }
1513            let mut ctx_stack = req_ctxt.get_context_stack(
1514                SERVICE_NAME.as_cstr(),
1515                METHOD_NAME.as_cstr(),
1516            )?;
1517            ::fbthrift::ContextStack::pre_read(&mut ctx_stack)?;
1518            let _args: self::Args_RaftexService_appendLog = ::fbthrift::Deserialize::read(p)?;
1519            ::fbthrift::ContextStack::on_read_data(&mut ctx_stack, &::fbthrift::SerializedMessage {
1520                protocol: P::PROTOCOL_ID,
1521                method_name: METHOD_NAME.as_cstr(),
1522                buffer: ::std::marker::PhantomData, // FIXME P::into_buffer(p).reset(),
1523            })?;
1524            ::fbthrift::ContextStack::post_read(&mut ctx_stack, 0)?;
1525
1526            let res = ::std::panic::AssertUnwindSafe(
1527                self.service.appendLog(
1528                    _args.req,
1529                )
1530            )
1531            .catch_unwind()
1532            .await;
1533
1534            // nested results - panic catch on the outside, method on the inside
1535            let res = match res {
1536                ::std::result::Result::Ok(::std::result::Result::Ok(res)) => {
1537                    ::tracing::info!("success");
1538                    crate::services::raftex_service::AppendLogExn::Success(res)
1539                }
1540                ::std::result::Result::Ok(::std::result::Result::Err(crate::services::raftex_service::AppendLogExn::Success(_))) => {
1541                    panic!(
1542                        "{} attempted to return success via error",
1543                        "appendLog",
1544                    )
1545                }
1546                ::std::result::Result::Ok(::std::result::Result::Err(exn)) => {
1547                    ::tracing::error!(exception = ?exn);
1548                    exn
1549                }
1550                ::std::result::Result::Err(exn) => {
1551                    let aexn = ::fbthrift::ApplicationException::handler_panic("RaftexService.appendLog", exn);
1552                    crate::services::raftex_service::AppendLogExn::ApplicationException(aexn)
1553                }
1554            };
1555
1556            let env = ::fbthrift::help::serialize_result_envelope::<P, R, _>(
1557                "appendLog",
1558                METHOD_NAME.as_cstr(),
1559                _seqid,
1560                req_ctxt,
1561                &mut ctx_stack,
1562                res
1563            )?;
1564            reply_state.lock().unwrap().send_reply(env);
1565            Ok(())
1566        }
1567
1568        #[::tracing::instrument(skip_all, name = "handler", fields(method = "RaftexService.sendSnapshot"))]
1569        async fn handle_sendSnapshot<'a>(
1570            &'a self,
1571            p: &'a mut P::Deserializer,
1572            req_ctxt: &R,
1573            reply_state: ::std::sync::Arc<::std::sync::Mutex<RS>>,
1574            _seqid: ::std::primitive::u32,
1575        ) -> ::anyhow::Result<()> {
1576            use ::const_cstr::const_cstr;
1577            use ::futures::FutureExt as _;
1578
1579            const_cstr! {
1580                SERVICE_NAME = "RaftexService";
1581                METHOD_NAME = "RaftexService.sendSnapshot";
1582            }
1583            let mut ctx_stack = req_ctxt.get_context_stack(
1584                SERVICE_NAME.as_cstr(),
1585                METHOD_NAME.as_cstr(),
1586            )?;
1587            ::fbthrift::ContextStack::pre_read(&mut ctx_stack)?;
1588            let _args: self::Args_RaftexService_sendSnapshot = ::fbthrift::Deserialize::read(p)?;
1589            ::fbthrift::ContextStack::on_read_data(&mut ctx_stack, &::fbthrift::SerializedMessage {
1590                protocol: P::PROTOCOL_ID,
1591                method_name: METHOD_NAME.as_cstr(),
1592                buffer: ::std::marker::PhantomData, // FIXME P::into_buffer(p).reset(),
1593            })?;
1594            ::fbthrift::ContextStack::post_read(&mut ctx_stack, 0)?;
1595
1596            let res = ::std::panic::AssertUnwindSafe(
1597                self.service.sendSnapshot(
1598                    _args.req,
1599                )
1600            )
1601            .catch_unwind()
1602            .await;
1603
1604            // nested results - panic catch on the outside, method on the inside
1605            let res = match res {
1606                ::std::result::Result::Ok(::std::result::Result::Ok(res)) => {
1607                    ::tracing::info!("success");
1608                    crate::services::raftex_service::SendSnapshotExn::Success(res)
1609                }
1610                ::std::result::Result::Ok(::std::result::Result::Err(crate::services::raftex_service::SendSnapshotExn::Success(_))) => {
1611                    panic!(
1612                        "{} attempted to return success via error",
1613                        "sendSnapshot",
1614                    )
1615                }
1616                ::std::result::Result::Ok(::std::result::Result::Err(exn)) => {
1617                    ::tracing::error!(exception = ?exn);
1618                    exn
1619                }
1620                ::std::result::Result::Err(exn) => {
1621                    let aexn = ::fbthrift::ApplicationException::handler_panic("RaftexService.sendSnapshot", exn);
1622                    crate::services::raftex_service::SendSnapshotExn::ApplicationException(aexn)
1623                }
1624            };
1625
1626            let env = ::fbthrift::help::serialize_result_envelope::<P, R, _>(
1627                "sendSnapshot",
1628                METHOD_NAME.as_cstr(),
1629                _seqid,
1630                req_ctxt,
1631                &mut ctx_stack,
1632                res
1633            )?;
1634            reply_state.lock().unwrap().send_reply(env);
1635            Ok(())
1636        }
1637
1638        #[::tracing::instrument(skip_all, name = "handler", fields(method = "RaftexService.heartbeat"))]
1639        async fn handle_heartbeat<'a>(
1640            &'a self,
1641            p: &'a mut P::Deserializer,
1642            req_ctxt: &R,
1643            reply_state: ::std::sync::Arc<::std::sync::Mutex<RS>>,
1644            _seqid: ::std::primitive::u32,
1645        ) -> ::anyhow::Result<()> {
1646            use ::const_cstr::const_cstr;
1647            use ::futures::FutureExt as _;
1648
1649            const_cstr! {
1650                SERVICE_NAME = "RaftexService";
1651                METHOD_NAME = "RaftexService.heartbeat";
1652            }
1653            let mut ctx_stack = req_ctxt.get_context_stack(
1654                SERVICE_NAME.as_cstr(),
1655                METHOD_NAME.as_cstr(),
1656            )?;
1657            ::fbthrift::ContextStack::pre_read(&mut ctx_stack)?;
1658            let _args: self::Args_RaftexService_heartbeat = ::fbthrift::Deserialize::read(p)?;
1659            ::fbthrift::ContextStack::on_read_data(&mut ctx_stack, &::fbthrift::SerializedMessage {
1660                protocol: P::PROTOCOL_ID,
1661                method_name: METHOD_NAME.as_cstr(),
1662                buffer: ::std::marker::PhantomData, // FIXME P::into_buffer(p).reset(),
1663            })?;
1664            ::fbthrift::ContextStack::post_read(&mut ctx_stack, 0)?;
1665
1666            let res = ::std::panic::AssertUnwindSafe(
1667                self.service.heartbeat(
1668                    _args.req,
1669                )
1670            )
1671            .catch_unwind()
1672            .await;
1673
1674            // nested results - panic catch on the outside, method on the inside
1675            let res = match res {
1676                ::std::result::Result::Ok(::std::result::Result::Ok(res)) => {
1677                    ::tracing::info!("success");
1678                    crate::services::raftex_service::HeartbeatExn::Success(res)
1679                }
1680                ::std::result::Result::Ok(::std::result::Result::Err(crate::services::raftex_service::HeartbeatExn::Success(_))) => {
1681                    panic!(
1682                        "{} attempted to return success via error",
1683                        "heartbeat",
1684                    )
1685                }
1686                ::std::result::Result::Ok(::std::result::Result::Err(exn)) => {
1687                    ::tracing::error!(exception = ?exn);
1688                    exn
1689                }
1690                ::std::result::Result::Err(exn) => {
1691                    let aexn = ::fbthrift::ApplicationException::handler_panic("RaftexService.heartbeat", exn);
1692                    crate::services::raftex_service::HeartbeatExn::ApplicationException(aexn)
1693                }
1694            };
1695
1696            let env = ::fbthrift::help::serialize_result_envelope::<P, R, _>(
1697                "heartbeat",
1698                METHOD_NAME.as_cstr(),
1699                _seqid,
1700                req_ctxt,
1701                &mut ctx_stack,
1702                res
1703            )?;
1704            reply_state.lock().unwrap().send_reply(env);
1705            Ok(())
1706        }
1707    }
1708
1709    #[::async_trait::async_trait]
1710    impl<P, H, R, RS> ::fbthrift::ServiceProcessor<P> for RaftexServiceProcessor<P, H, R, RS>
1711    where
1712        P: ::fbthrift::Protocol + ::std::marker::Send + ::std::marker::Sync + 'static,
1713        P::Deserializer: ::std::marker::Send,
1714        H: RaftexService,
1715        P::Frame: ::std::marker::Send + 'static,
1716        R: ::fbthrift::RequestContext<Name = ::std::ffi::CStr> + ::std::marker::Send + ::std::marker::Sync + 'static,
1717        <R as ::fbthrift::RequestContext>::ContextStack: ::fbthrift::ContextStack<Name = R::Name, Buffer = ::fbthrift::ProtocolDecoded<P>>
1718            + ::std::marker::Send + ::std::marker::Sync + 'static,
1719        RS: ::fbthrift::ReplyState<P::Frame, RequestContext = R> + ::std::marker::Send + ::std::marker::Sync + 'static
1720    {
1721        type RequestContext = R;
1722        type ReplyState = RS;
1723
1724        #[inline]
1725        fn method_idx(&self, name: &[::std::primitive::u8]) -> ::std::result::Result<::std::primitive::usize, ::fbthrift::ApplicationException> {
1726            match name {
1727                b"askForVote" => ::std::result::Result::Ok(0usize),
1728                b"appendLog" => ::std::result::Result::Ok(1usize),
1729                b"sendSnapshot" => ::std::result::Result::Ok(2usize),
1730                b"heartbeat" => ::std::result::Result::Ok(3usize),
1731                _ => ::std::result::Result::Err(::fbthrift::ApplicationException::unknown_method()),
1732            }
1733        }
1734
1735        #[allow(clippy::match_single_binding)]
1736        async fn handle_method(
1737            &self,
1738            idx: ::std::primitive::usize,
1739            _p: &mut P::Deserializer,
1740            _r: &R,
1741            _reply_state: ::std::sync::Arc<::std::sync::Mutex<RS>>,
1742            _seqid: ::std::primitive::u32,
1743        ) -> ::anyhow::Result<()> {
1744            match idx {
1745                0usize => {
1746                    self.handle_askForVote(_p, _r, _reply_state, _seqid).await
1747                }
1748                1usize => {
1749                    self.handle_appendLog(_p, _r, _reply_state, _seqid).await
1750                }
1751                2usize => {
1752                    self.handle_sendSnapshot(_p, _r, _reply_state, _seqid).await
1753                }
1754                3usize => {
1755                    self.handle_heartbeat(_p, _r, _reply_state, _seqid).await
1756                }
1757                bad => panic!(
1758                    "{}: unexpected method idx {}",
1759                    "RaftexServiceProcessor",
1760                    bad
1761                ),
1762            }
1763        }
1764
1765        #[allow(clippy::match_single_binding)]
1766        #[inline]
1767        fn create_interaction_idx(&self, name: &str) -> ::anyhow::Result<::std::primitive::usize> {
1768            match name {
1769                _ => ::anyhow::bail!("Unknown interaction"),
1770            }
1771        }
1772
1773        #[allow(clippy::match_single_binding)]
1774        fn handle_create_interaction(
1775            &self,
1776            idx: ::std::primitive::usize,
1777        ) -> ::anyhow::Result<
1778            ::std::sync::Arc<dyn ::fbthrift::ThriftService<P::Frame, Handler = (), RequestContext = Self::RequestContext, ReplyState = Self::ReplyState> + ::std::marker::Send + 'static>
1779        > {
1780            match idx {
1781                bad => panic!(
1782                    "{}: unexpected method idx {}",
1783                    "RaftexServiceProcessor",
1784                    bad
1785                ),
1786            }
1787        }
1788    }
1789
1790    #[::async_trait::async_trait]
1791    impl<P, H, R, RS> ::fbthrift::ThriftService<P::Frame> for RaftexServiceProcessor<P, H, R, RS>
1792    where
1793        P: ::fbthrift::Protocol + ::std::marker::Send + ::std::marker::Sync + 'static,
1794        P::Deserializer: ::std::marker::Send,
1795        P::Frame: ::std::marker::Send + 'static,
1796        H: RaftexService,
1797        R: ::fbthrift::RequestContext<Name = ::std::ffi::CStr> + ::std::marker::Send + ::std::marker::Sync + 'static,
1798        <R as ::fbthrift::RequestContext>::ContextStack: ::fbthrift::ContextStack<Name = R::Name, Buffer = ::fbthrift::ProtocolDecoded<P>>
1799            + ::std::marker::Send + ::std::marker::Sync + 'static,
1800        RS: ::fbthrift::ReplyState<P::Frame, RequestContext = R> + ::std::marker::Send + ::std::marker::Sync + 'static
1801    {
1802        type Handler = H;
1803        type RequestContext = R;
1804        type ReplyState = RS;
1805
1806        #[tracing::instrument(level="trace", skip_all, fields(service = "RaftexService"))]
1807        async fn call(
1808            &self,
1809            req: ::fbthrift::ProtocolDecoded<P>,
1810            req_ctxt: &R,
1811            reply_state: ::std::sync::Arc<::std::sync::Mutex<RS>>,
1812        ) -> ::anyhow::Result<()> {
1813            use ::fbthrift::{BufExt as _, ProtocolReader as _, ServiceProcessor as _};
1814            let mut p = P::deserializer(req);
1815            let (idx, mty, seqid) = p.read_message_begin(|name| self.method_idx(name))?;
1816            if mty != ::fbthrift::MessageType::Call {
1817                return ::std::result::Result::Err(::std::convert::From::from(::fbthrift::ApplicationException::new(
1818                    ::fbthrift::ApplicationExceptionErrorCode::InvalidMessageType,
1819                    format!("message type {:?} not handled", mty)
1820                )));
1821            }
1822            let idx = match idx {
1823                ::std::result::Result::Ok(idx) => idx,
1824                ::std::result::Result::Err(_) => {
1825                    let cur = P::into_buffer(p).reset();
1826                    return self.supa.call(cur, req_ctxt, reply_state).await;
1827                }
1828            };
1829            self.handle_method(idx, &mut p, req_ctxt, reply_state, seqid).await?;
1830            p.read_message_end()?;
1831
1832            Ok(())
1833        }
1834
1835        fn create_interaction(
1836            &self,
1837            name: &str,
1838        ) -> ::anyhow::Result<
1839            ::std::sync::Arc<dyn ::fbthrift::ThriftService<P::Frame, Handler = (), RequestContext = R, ReplyState = RS> + ::std::marker::Send + 'static>
1840        > {
1841            use ::fbthrift::{ServiceProcessor as _};
1842            let idx = self.create_interaction_idx(name);
1843            let idx = match idx {
1844                ::anyhow::Result::Ok(idx) => idx,
1845                ::anyhow::Result::Err(_) => {
1846                    return self.supa.create_interaction(name);
1847                }
1848            };
1849            self.handle_create_interaction(idx)
1850        }
1851
1852        fn get_method_names(&self) -> &'static [&'static str] {
1853            &[
1854                // from RaftexService
1855                "askForVote",
1856                "appendLog",
1857                "sendSnapshot",
1858                "heartbeat",
1859            ]
1860        }
1861    }
1862
1863    /// Construct a new instance of a RaftexService service.
1864    ///
1865    /// This is called when a new instance of a Thrift service Processor
1866    /// is needed for a particular Thrift protocol.
1867    #[::tracing::instrument(level="debug", skip_all, fields(proto = ?proto))]
1868    pub fn make_RaftexService_server<F, H, R, RS>(
1869        proto: ::fbthrift::ProtocolID,
1870        handler: H,
1871    ) -> ::std::result::Result<::std::boxed::Box<dyn ::fbthrift::ThriftService<F, Handler = H, RequestContext = R, ReplyState = RS> + ::std::marker::Send + 'static>, ::fbthrift::ApplicationException>
1872    where
1873        F: ::fbthrift::Framing + ::std::marker::Send + ::std::marker::Sync + 'static,
1874        H: RaftexService,
1875        R: ::fbthrift::RequestContext<Name = ::std::ffi::CStr> + ::std::marker::Send + ::std::marker::Sync + 'static,
1876        <R as ::fbthrift::RequestContext>::ContextStack: ::fbthrift::ContextStack<Name = R::Name, Buffer = F::DecBuf> + ::std::marker::Send + ::std::marker::Sync + 'static,
1877        RS: ::fbthrift::ReplyState<F, RequestContext = R> + ::std::marker::Send + ::std::marker::Sync + 'static
1878    {
1879        match proto {
1880            ::fbthrift::ProtocolID::BinaryProtocol => {
1881                ::std::result::Result::Ok(::std::boxed::Box::new(RaftexServiceProcessor::<::fbthrift::BinaryProtocol<F>, H, R, RS>::new(handler)))
1882            }
1883            ::fbthrift::ProtocolID::CompactProtocol => {
1884                ::std::result::Result::Ok(::std::boxed::Box::new(RaftexServiceProcessor::<::fbthrift::CompactProtocol<F>, H, R, RS>::new(handler)))
1885            }
1886            bad => {
1887                ::tracing::error!(method = "RaftexService.", invalid_protocol = ?bad);
1888                ::std::result::Result::Err(::fbthrift::ApplicationException::invalid_protocol(bad))
1889            }
1890        }
1891    }
1892}
1893
1894/// Client mocks. For every service, a struct mock::TheService that implements
1895/// client::TheService.
1896///
1897/// As an example of the generated API, for the following thrift service:
1898///
1899/// ```thrift
1900/// service MyService {
1901///     FunctionResponse myFunction(
1902///         1: FunctionRequest request,
1903///     ) throws {
1904///         1: StorageException s,
1905///         2: NotFoundException n,
1906///     ),
1907///
1908///     // other functions
1909/// }
1910/// ```
1911///
1912/// we would end up with this mock object under crate::mock::MyService:
1913///
1914/// ```
1915/// # const _: &str = stringify! {
1916/// impl crate::client::MyService for MyService<'mock> {...}
1917///
1918/// pub struct MyService<'mock> {
1919///     pub myFunction: myFunction<'mock>,
1920///     // ...
1921/// }
1922///
1923/// impl dyn crate::client::MyService {
1924///     pub fn mock<'mock>() -> MyService<'mock>;
1925/// }
1926///
1927/// impl myFunction<'mock> {
1928///     // directly return the given success response
1929///     pub fn ret(&self, value: FunctionResponse);
1930///
1931///     // invoke closure to compute success response
1932///     pub fn mock(
1933///         &self,
1934///         mock: impl FnMut(FunctionRequest) -> FunctionResponse + Send + Sync + 'mock,
1935///     );
1936///
1937///     // invoke closure to compute response
1938///     pub fn mock_result(
1939///         &self,
1940///         mock: impl FnMut(FunctionRequest) -> Result<FunctionResponse, crate::services::MyService::MyFunctionExn> + Send + Sync + 'mock,
1941///     );
1942///
1943///     // return one of the function's declared exceptions
1944///     pub fn throw<E>(&self, exception: E)
1945///     where
1946///         E: Clone + Into<crate::services::MyService::MyFunctionExn> + Send + Sync + 'mock;
1947/// }
1948///
1949/// impl From<StorageException> for MyFunctionExn {...}
1950/// impl From<NotFoundException> for MyFunctionExn {...}
1951/// # };
1952/// ```
1953///
1954/// The intended usage from a test would be:
1955///
1956/// ```
1957/// # const _: &str = stringify! {
1958/// use std::sync::Arc;
1959/// use thrift_if::client::MyService;
1960///
1961/// #[test]
1962/// fn test_my_client() {
1963///     let mock = Arc::new(<dyn MyService>::mock());
1964///
1965///     // directly return a success response
1966///     let resp = FunctionResponse {...};
1967///     mock.myFunction.ret(resp);
1968///
1969///     // or give a closure to compute the success response
1970///     mock.myFunction.mock(|request| FunctionResponse {...});
1971///
1972///     // or throw one of the function's exceptions
1973///     mock.myFunction.throw(StorageException::ItFailed);
1974///
1975///     // or compute a Result (useful if your exceptions aren't Clone)
1976///     mock.myFunction.mock_result(|request| Err(...));
1977///
1978///     let out = do_the_thing(mock).wait().unwrap();
1979///     assert!(out.what_i_expected());
1980/// }
1981///
1982/// fn do_the_thing(
1983///     client: Arc<dyn MyService + Send + Sync + 'static>,
1984/// ) -> impl Future<Item = Out> {...}
1985/// # };
1986/// ```
1987pub mod mock {
1988    pub struct RaftexService<'mock> {
1989        pub askForVote: r#impl::raftex_service::askForVote<'mock>,
1990        pub appendLog: r#impl::raftex_service::appendLog<'mock>,
1991        pub sendSnapshot: r#impl::raftex_service::sendSnapshot<'mock>,
1992        pub heartbeat: r#impl::raftex_service::heartbeat<'mock>,
1993        _marker: ::std::marker::PhantomData<&'mock ()>,
1994    }
1995
1996    impl dyn super::client::RaftexService {
1997        pub fn mock<'mock>() -> RaftexService<'mock> {
1998            RaftexService {
1999                askForVote: r#impl::raftex_service::askForVote::unimplemented(),
2000                appendLog: r#impl::raftex_service::appendLog::unimplemented(),
2001                sendSnapshot: r#impl::raftex_service::sendSnapshot::unimplemented(),
2002                heartbeat: r#impl::raftex_service::heartbeat::unimplemented(),
2003                _marker: ::std::marker::PhantomData,
2004            }
2005        }
2006    }
2007
2008    impl<'mock> super::client::RaftexService for RaftexService<'mock> {
2009        fn askForVote(
2010            &self,
2011            arg_req: &crate::types::AskForVoteRequest,
2012        ) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::AskForVoteResponse, crate::errors::raftex_service::AskForVoteError>> {
2013            let mut closure = self.askForVote.closure.lock().unwrap();
2014            let closure: &mut dyn ::std::ops::FnMut(crate::types::AskForVoteRequest) -> _ = &mut **closure;
2015            ::std::boxed::Box::pin(::futures::future::ready(closure(arg_req.clone())))
2016        }
2017        fn appendLog(
2018            &self,
2019            arg_req: &crate::types::AppendLogRequest,
2020        ) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::AppendLogResponse, crate::errors::raftex_service::AppendLogError>> {
2021            let mut closure = self.appendLog.closure.lock().unwrap();
2022            let closure: &mut dyn ::std::ops::FnMut(crate::types::AppendLogRequest) -> _ = &mut **closure;
2023            ::std::boxed::Box::pin(::futures::future::ready(closure(arg_req.clone())))
2024        }
2025        fn sendSnapshot(
2026            &self,
2027            arg_req: &crate::types::SendSnapshotRequest,
2028        ) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::SendSnapshotResponse, crate::errors::raftex_service::SendSnapshotError>> {
2029            let mut closure = self.sendSnapshot.closure.lock().unwrap();
2030            let closure: &mut dyn ::std::ops::FnMut(crate::types::SendSnapshotRequest) -> _ = &mut **closure;
2031            ::std::boxed::Box::pin(::futures::future::ready(closure(arg_req.clone())))
2032        }
2033        fn heartbeat(
2034            &self,
2035            arg_req: &crate::types::HeartbeatRequest,
2036        ) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::HeartbeatResponse, crate::errors::raftex_service::HeartbeatError>> {
2037            let mut closure = self.heartbeat.closure.lock().unwrap();
2038            let closure: &mut dyn ::std::ops::FnMut(crate::types::HeartbeatRequest) -> _ = &mut **closure;
2039            ::std::boxed::Box::pin(::futures::future::ready(closure(arg_req.clone())))
2040        }
2041    }
2042
2043    mod r#impl {
2044        pub mod raftex_service {
2045
2046            pub struct askForVote<'mock> {
2047                pub(crate) closure: ::std::sync::Mutex<::std::boxed::Box<
2048                    dyn ::std::ops::FnMut(crate::types::AskForVoteRequest) -> ::std::result::Result<
2049                        crate::types::AskForVoteResponse,
2050                        crate::errors::raftex_service::AskForVoteError,
2051                    > + ::std::marker::Send + ::std::marker::Sync + 'mock,
2052                >>,
2053            }
2054
2055            #[allow(clippy::redundant_closure)]
2056            impl<'mock> askForVote<'mock> {
2057                pub fn unimplemented() -> Self {
2058                    Self {
2059                        closure: ::std::sync::Mutex::new(::std::boxed::Box::new(|_: crate::types::AskForVoteRequest| panic!(
2060                            "{}::{} is not mocked",
2061                            "RaftexService",
2062                            "askForVote",
2063                        ))),
2064                    }
2065                }
2066
2067                pub fn ret(&self, value: crate::types::AskForVoteResponse) {
2068                    self.mock(move |_: crate::types::AskForVoteRequest| value.clone());
2069                }
2070
2071                pub fn mock(&self, mut mock: impl ::std::ops::FnMut(crate::types::AskForVoteRequest) -> crate::types::AskForVoteResponse + ::std::marker::Send + ::std::marker::Sync + 'mock) {
2072                    let mut closure = self.closure.lock().unwrap();
2073                    *closure = ::std::boxed::Box::new(move |req| ::std::result::Result::Ok(mock(req)));
2074                }
2075
2076                pub fn mock_result(&self, mut mock: impl ::std::ops::FnMut(crate::types::AskForVoteRequest) -> ::std::result::Result<crate::types::AskForVoteResponse, crate::errors::raftex_service::AskForVoteError> + ::std::marker::Send + ::std::marker::Sync + 'mock) {
2077                    let mut closure = self.closure.lock().unwrap();
2078                    *closure = ::std::boxed::Box::new(move |req| mock(req));
2079                }
2080
2081                pub fn throw<E>(&self, exception: E)
2082                where
2083                    E: ::std::convert::Into<crate::errors::raftex_service::AskForVoteError>,
2084                    E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock,
2085                {
2086                    let mut closure = self.closure.lock().unwrap();
2087                    *closure = ::std::boxed::Box::new(move |_: crate::types::AskForVoteRequest| ::std::result::Result::Err(exception.clone().into()));
2088                }
2089            }
2090
2091            pub struct appendLog<'mock> {
2092                pub(crate) closure: ::std::sync::Mutex<::std::boxed::Box<
2093                    dyn ::std::ops::FnMut(crate::types::AppendLogRequest) -> ::std::result::Result<
2094                        crate::types::AppendLogResponse,
2095                        crate::errors::raftex_service::AppendLogError,
2096                    > + ::std::marker::Send + ::std::marker::Sync + 'mock,
2097                >>,
2098            }
2099
2100            #[allow(clippy::redundant_closure)]
2101            impl<'mock> appendLog<'mock> {
2102                pub fn unimplemented() -> Self {
2103                    Self {
2104                        closure: ::std::sync::Mutex::new(::std::boxed::Box::new(|_: crate::types::AppendLogRequest| panic!(
2105                            "{}::{} is not mocked",
2106                            "RaftexService",
2107                            "appendLog",
2108                        ))),
2109                    }
2110                }
2111
2112                pub fn ret(&self, value: crate::types::AppendLogResponse) {
2113                    self.mock(move |_: crate::types::AppendLogRequest| value.clone());
2114                }
2115
2116                pub fn mock(&self, mut mock: impl ::std::ops::FnMut(crate::types::AppendLogRequest) -> crate::types::AppendLogResponse + ::std::marker::Send + ::std::marker::Sync + 'mock) {
2117                    let mut closure = self.closure.lock().unwrap();
2118                    *closure = ::std::boxed::Box::new(move |req| ::std::result::Result::Ok(mock(req)));
2119                }
2120
2121                pub fn mock_result(&self, mut mock: impl ::std::ops::FnMut(crate::types::AppendLogRequest) -> ::std::result::Result<crate::types::AppendLogResponse, crate::errors::raftex_service::AppendLogError> + ::std::marker::Send + ::std::marker::Sync + 'mock) {
2122                    let mut closure = self.closure.lock().unwrap();
2123                    *closure = ::std::boxed::Box::new(move |req| mock(req));
2124                }
2125
2126                pub fn throw<E>(&self, exception: E)
2127                where
2128                    E: ::std::convert::Into<crate::errors::raftex_service::AppendLogError>,
2129                    E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock,
2130                {
2131                    let mut closure = self.closure.lock().unwrap();
2132                    *closure = ::std::boxed::Box::new(move |_: crate::types::AppendLogRequest| ::std::result::Result::Err(exception.clone().into()));
2133                }
2134            }
2135
2136            pub struct sendSnapshot<'mock> {
2137                pub(crate) closure: ::std::sync::Mutex<::std::boxed::Box<
2138                    dyn ::std::ops::FnMut(crate::types::SendSnapshotRequest) -> ::std::result::Result<
2139                        crate::types::SendSnapshotResponse,
2140                        crate::errors::raftex_service::SendSnapshotError,
2141                    > + ::std::marker::Send + ::std::marker::Sync + 'mock,
2142                >>,
2143            }
2144
2145            #[allow(clippy::redundant_closure)]
2146            impl<'mock> sendSnapshot<'mock> {
2147                pub fn unimplemented() -> Self {
2148                    Self {
2149                        closure: ::std::sync::Mutex::new(::std::boxed::Box::new(|_: crate::types::SendSnapshotRequest| panic!(
2150                            "{}::{} is not mocked",
2151                            "RaftexService",
2152                            "sendSnapshot",
2153                        ))),
2154                    }
2155                }
2156
2157                pub fn ret(&self, value: crate::types::SendSnapshotResponse) {
2158                    self.mock(move |_: crate::types::SendSnapshotRequest| value.clone());
2159                }
2160
2161                pub fn mock(&self, mut mock: impl ::std::ops::FnMut(crate::types::SendSnapshotRequest) -> crate::types::SendSnapshotResponse + ::std::marker::Send + ::std::marker::Sync + 'mock) {
2162                    let mut closure = self.closure.lock().unwrap();
2163                    *closure = ::std::boxed::Box::new(move |req| ::std::result::Result::Ok(mock(req)));
2164                }
2165
2166                pub fn mock_result(&self, mut mock: impl ::std::ops::FnMut(crate::types::SendSnapshotRequest) -> ::std::result::Result<crate::types::SendSnapshotResponse, crate::errors::raftex_service::SendSnapshotError> + ::std::marker::Send + ::std::marker::Sync + 'mock) {
2167                    let mut closure = self.closure.lock().unwrap();
2168                    *closure = ::std::boxed::Box::new(move |req| mock(req));
2169                }
2170
2171                pub fn throw<E>(&self, exception: E)
2172                where
2173                    E: ::std::convert::Into<crate::errors::raftex_service::SendSnapshotError>,
2174                    E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock,
2175                {
2176                    let mut closure = self.closure.lock().unwrap();
2177                    *closure = ::std::boxed::Box::new(move |_: crate::types::SendSnapshotRequest| ::std::result::Result::Err(exception.clone().into()));
2178                }
2179            }
2180
2181            pub struct heartbeat<'mock> {
2182                pub(crate) closure: ::std::sync::Mutex<::std::boxed::Box<
2183                    dyn ::std::ops::FnMut(crate::types::HeartbeatRequest) -> ::std::result::Result<
2184                        crate::types::HeartbeatResponse,
2185                        crate::errors::raftex_service::HeartbeatError,
2186                    > + ::std::marker::Send + ::std::marker::Sync + 'mock,
2187                >>,
2188            }
2189
2190            #[allow(clippy::redundant_closure)]
2191            impl<'mock> heartbeat<'mock> {
2192                pub fn unimplemented() -> Self {
2193                    Self {
2194                        closure: ::std::sync::Mutex::new(::std::boxed::Box::new(|_: crate::types::HeartbeatRequest| panic!(
2195                            "{}::{} is not mocked",
2196                            "RaftexService",
2197                            "heartbeat",
2198                        ))),
2199                    }
2200                }
2201
2202                pub fn ret(&self, value: crate::types::HeartbeatResponse) {
2203                    self.mock(move |_: crate::types::HeartbeatRequest| value.clone());
2204                }
2205
2206                pub fn mock(&self, mut mock: impl ::std::ops::FnMut(crate::types::HeartbeatRequest) -> crate::types::HeartbeatResponse + ::std::marker::Send + ::std::marker::Sync + 'mock) {
2207                    let mut closure = self.closure.lock().unwrap();
2208                    *closure = ::std::boxed::Box::new(move |req| ::std::result::Result::Ok(mock(req)));
2209                }
2210
2211                pub fn mock_result(&self, mut mock: impl ::std::ops::FnMut(crate::types::HeartbeatRequest) -> ::std::result::Result<crate::types::HeartbeatResponse, crate::errors::raftex_service::HeartbeatError> + ::std::marker::Send + ::std::marker::Sync + 'mock) {
2212                    let mut closure = self.closure.lock().unwrap();
2213                    *closure = ::std::boxed::Box::new(move |req| mock(req));
2214                }
2215
2216                pub fn throw<E>(&self, exception: E)
2217                where
2218                    E: ::std::convert::Into<crate::errors::raftex_service::HeartbeatError>,
2219                    E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock,
2220                {
2221                    let mut closure = self.closure.lock().unwrap();
2222                    *closure = ::std::boxed::Box::new(move |_: crate::types::HeartbeatRequest| ::std::result::Result::Err(exception.clone().into()));
2223                }
2224            }
2225        }
2226    }
2227}
2228
2229/// Error return types.
2230pub mod errors {
2231    /// Errors for RaftexService functions.
2232    pub mod raftex_service {
2233
2234        pub type AskForVoteError = ::fbthrift::NonthrowingFunctionError;
2235
2236        impl ::std::convert::From<crate::services::raftex_service::AskForVoteExn> for
2237            ::std::result::Result<crate::types::AskForVoteResponse, AskForVoteError>
2238        {
2239            fn from(e: crate::services::raftex_service::AskForVoteExn) -> Self {
2240                match e {
2241                    crate::services::raftex_service::AskForVoteExn::Success(res) => {
2242                        ::std::result::Result::Ok(res)
2243                    }
2244                    crate::services::raftex_service::AskForVoteExn::ApplicationException(aexn) =>
2245                        ::std::result::Result::Err(AskForVoteError::ApplicationException(aexn)),
2246                }
2247            }
2248        }
2249
2250        pub type AppendLogError = ::fbthrift::NonthrowingFunctionError;
2251
2252        impl ::std::convert::From<crate::services::raftex_service::AppendLogExn> for
2253            ::std::result::Result<crate::types::AppendLogResponse, AppendLogError>
2254        {
2255            fn from(e: crate::services::raftex_service::AppendLogExn) -> Self {
2256                match e {
2257                    crate::services::raftex_service::AppendLogExn::Success(res) => {
2258                        ::std::result::Result::Ok(res)
2259                    }
2260                    crate::services::raftex_service::AppendLogExn::ApplicationException(aexn) =>
2261                        ::std::result::Result::Err(AppendLogError::ApplicationException(aexn)),
2262                }
2263            }
2264        }
2265
2266        pub type SendSnapshotError = ::fbthrift::NonthrowingFunctionError;
2267
2268        impl ::std::convert::From<crate::services::raftex_service::SendSnapshotExn> for
2269            ::std::result::Result<crate::types::SendSnapshotResponse, SendSnapshotError>
2270        {
2271            fn from(e: crate::services::raftex_service::SendSnapshotExn) -> Self {
2272                match e {
2273                    crate::services::raftex_service::SendSnapshotExn::Success(res) => {
2274                        ::std::result::Result::Ok(res)
2275                    }
2276                    crate::services::raftex_service::SendSnapshotExn::ApplicationException(aexn) =>
2277                        ::std::result::Result::Err(SendSnapshotError::ApplicationException(aexn)),
2278                }
2279            }
2280        }
2281
2282        pub type HeartbeatError = ::fbthrift::NonthrowingFunctionError;
2283
2284        impl ::std::convert::From<crate::services::raftex_service::HeartbeatExn> for
2285            ::std::result::Result<crate::types::HeartbeatResponse, HeartbeatError>
2286        {
2287            fn from(e: crate::services::raftex_service::HeartbeatExn) -> Self {
2288                match e {
2289                    crate::services::raftex_service::HeartbeatExn::Success(res) => {
2290                        ::std::result::Result::Ok(res)
2291                    }
2292                    crate::services::raftex_service::HeartbeatExn::ApplicationException(aexn) =>
2293                        ::std::result::Result::Err(HeartbeatError::ApplicationException(aexn)),
2294                }
2295            }
2296        }
2297
2298    }
2299
2300}