nebula_fbthrift_graph_v1/
lib.rs

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