// @generated by Thrift for thrift/compiler/test/fixtures/basic-annotations/src/module.thrift // This file is probably not the place you want to edit! //! Thrift error definitions for `module`. /// Error definitions for `MyService`. pub mod my_service { pub trait AsMyException { fn as_my_exception(&self) -> Option<&crate::types::MyException>; } impl AsMyException for ::anyhow::Error { fn as_my_exception(&self) -> Option<&crate::types::MyException> { for cause in self.chain() { if let Some(PingError::myExcept(e)) = cause.downcast_ref::() { return Some(e); } } None } } /// Errors for ping (client side). #[derive(Debug)] pub enum PingError { myExcept(crate::types::MyException), ApplicationException(::fbthrift::ApplicationException), ThriftError(::anyhow::Error), } /// Human-readable string representation of the Thrift client error. /// /// By default, this will not print the full cause chain. If you would like to print the underlying error /// cause, either use `format!("{:?}", anyhow::Error::from(client_err))` or print this using the /// alternate formatter `{:#}` instead of just `{}`. impl ::std::fmt::Display for PingError { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::result::Result<(), ::std::fmt::Error> { match self { Self::myExcept(inner) => { if f.alternate() { write!(f, "MyService::ping failed with variant `myExcept`: {:#}", inner)?; } else { write!(f, "MyService::ping failed with myExcept(MyException)")?; } } Self::ApplicationException(inner) => { write!(f, "MyService::ping failed with ApplicationException")?; if f.alternate() { write!(f, ": {:#}", inner)?; } } Self::ThriftError(inner) => { write!(f, "MyService::ping failed with ThriftError")?; if f.alternate() { write!(f, ": {:#}", inner)?; } } } Ok(()) } } impl ::std::error::Error for PingError { fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> { match self { Self::myExcept(ref inner) => { Some(inner) } Self::ApplicationException(ref inner) => { Some(inner) } Self::ThriftError(ref inner) => { Some(inner.as_ref()) } } } } impl ::std::convert::From for PingError { fn from(e: crate::types::MyException) -> Self { Self::myExcept(e) } } impl AsMyException for PingError { fn as_my_exception(&self) -> Option<&crate::types::MyException> { match self { Self::myExcept(inner) => Some(inner), _ => None, } } } impl ::std::convert::From<::anyhow::Error> for PingError { fn from(err: ::anyhow::Error) -> Self { Self::ThriftError(err) } } impl ::std::convert::From<::fbthrift::ApplicationException> for PingError { fn from(ae: ::fbthrift::ApplicationException) -> Self { Self::ApplicationException(ae) } } impl ::std::convert::From for PingError { fn from(e: crate::services::my_service::PingExn) -> Self { match e { crate::services::my_service::PingExn::ApplicationException(aexn) => PingError::ApplicationException(aexn), crate::services::my_service::PingExn::myExcept(exn) => PingError::myExcept(exn), } } } #[doc(hidden)] pub enum PingReader {} impl ::fbthrift::help::DeserializeExn for PingReader { type Success = (); type Error = PingError; fn read_result

(p: &mut P) -> ::anyhow::Result<::std::result::Result> where P: ::fbthrift::ProtocolReader, { static RETURNS: &[::fbthrift::Field] = &[ ::fbthrift::Field::new("Success", ::fbthrift::TType::Void, 0), ::fbthrift::Field::new("myExcept", ::fbthrift::TType::Struct, 1), ]; let _ = p.read_struct_begin(|_| ())?; let mut once = false; let mut alt = ::std::result::Result::Ok(()); loop { let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?; match ((fty, fid as ::std::primitive::i32), once) { ((::fbthrift::TType::Stop, _), _) => { p.read_field_end()?; break; } ((::fbthrift::TType::Void, 0i32), false) => { once = true; alt = ::std::result::Result::Ok(::fbthrift::Deserialize::read(p)?); } ((::fbthrift::TType::Struct, 1), false) => { once = true; alt = ::std::result::Result::Err(Self::Error::myExcept(::fbthrift::Deserialize::read(p)?)); } ((ty, _id), false) => p.skip(ty)?, ((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from( ::fbthrift::ApplicationException::new( ::fbthrift::ApplicationExceptionErrorCode::ProtocolError, format!( "unwanted extra union {} field ty {:?} id {}", "PingError", badty, badid, ), ) )), } p.read_field_end()?; } p.read_struct_end()?; ::std::result::Result::Ok(alt) } } pub type GetRandomDataError = ::fbthrift::NonthrowingFunctionError; impl ::std::convert::From for GetRandomDataError { fn from(e: crate::services::my_service::GetRandomDataExn) -> Self { match e { crate::services::my_service::GetRandomDataExn::ApplicationException(aexn) => GetRandomDataError::ApplicationException(aexn), } } } #[doc(hidden)] pub enum GetRandomDataReader {} impl ::fbthrift::help::DeserializeExn for GetRandomDataReader { type Success = ::std::string::String; type Error = GetRandomDataError; fn read_result

(p: &mut P) -> ::anyhow::Result<::std::result::Result> where P: ::fbthrift::ProtocolReader, { static RETURNS: &[::fbthrift::Field] = &[ ::fbthrift::Field::new("Success", ::fbthrift::TType::String, 0), ]; let _ = p.read_struct_begin(|_| ())?; let mut once = false; let mut alt = ::std::option::Option::None; loop { let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?; match ((fty, fid as ::std::primitive::i32), once) { ((::fbthrift::TType::Stop, _), _) => { p.read_field_end()?; break; } ((::fbthrift::TType::String, 0i32), false) => { once = true; alt = ::std::option::Option::Some(::std::result::Result::Ok(::fbthrift::Deserialize::read(p)?)); } ((ty, _id), false) => p.skip(ty)?, ((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from( ::fbthrift::ApplicationException::new( ::fbthrift::ApplicationExceptionErrorCode::ProtocolError, format!( "unwanted extra union {} field ty {:?} id {}", "GetRandomDataError", badty, badid, ), ) )), } p.read_field_end()?; } p.read_struct_end()?; alt.ok_or_else(|| ::fbthrift::ApplicationException::new( ::fbthrift::ApplicationExceptionErrorCode::MissingResult, format!("Empty union {}", "GetRandomDataError"), ) .into(), ) } } pub type HasDataByIdError = ::fbthrift::NonthrowingFunctionError; impl ::std::convert::From for HasDataByIdError { fn from(e: crate::services::my_service::HasDataByIdExn) -> Self { match e { crate::services::my_service::HasDataByIdExn::ApplicationException(aexn) => HasDataByIdError::ApplicationException(aexn), } } } #[doc(hidden)] pub enum HasDataByIdReader {} impl ::fbthrift::help::DeserializeExn for HasDataByIdReader { type Success = ::std::primitive::bool; type Error = HasDataByIdError; fn read_result

(p: &mut P) -> ::anyhow::Result<::std::result::Result> where P: ::fbthrift::ProtocolReader, { static RETURNS: &[::fbthrift::Field] = &[ ::fbthrift::Field::new("Success", ::fbthrift::TType::Bool, 0), ]; let _ = p.read_struct_begin(|_| ())?; let mut once = false; let mut alt = ::std::option::Option::None; loop { let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?; match ((fty, fid as ::std::primitive::i32), once) { ((::fbthrift::TType::Stop, _), _) => { p.read_field_end()?; break; } ((::fbthrift::TType::Bool, 0i32), false) => { once = true; alt = ::std::option::Option::Some(::std::result::Result::Ok(::fbthrift::Deserialize::read(p)?)); } ((ty, _id), false) => p.skip(ty)?, ((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from( ::fbthrift::ApplicationException::new( ::fbthrift::ApplicationExceptionErrorCode::ProtocolError, format!( "unwanted extra union {} field ty {:?} id {}", "HasDataByIdError", badty, badid, ), ) )), } p.read_field_end()?; } p.read_struct_end()?; alt.ok_or_else(|| ::fbthrift::ApplicationException::new( ::fbthrift::ApplicationExceptionErrorCode::MissingResult, format!("Empty union {}", "HasDataByIdError"), ) .into(), ) } } pub type GetDataByIdError = ::fbthrift::NonthrowingFunctionError; impl ::std::convert::From for GetDataByIdError { fn from(e: crate::services::my_service::GetDataByIdExn) -> Self { match e { crate::services::my_service::GetDataByIdExn::ApplicationException(aexn) => GetDataByIdError::ApplicationException(aexn), } } } #[doc(hidden)] pub enum GetDataByIdReader {} impl ::fbthrift::help::DeserializeExn for GetDataByIdReader { type Success = ::std::string::String; type Error = GetDataByIdError; fn read_result

(p: &mut P) -> ::anyhow::Result<::std::result::Result> where P: ::fbthrift::ProtocolReader, { static RETURNS: &[::fbthrift::Field] = &[ ::fbthrift::Field::new("Success", ::fbthrift::TType::String, 0), ]; let _ = p.read_struct_begin(|_| ())?; let mut once = false; let mut alt = ::std::option::Option::None; loop { let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?; match ((fty, fid as ::std::primitive::i32), once) { ((::fbthrift::TType::Stop, _), _) => { p.read_field_end()?; break; } ((::fbthrift::TType::String, 0i32), false) => { once = true; alt = ::std::option::Option::Some(::std::result::Result::Ok(::fbthrift::Deserialize::read(p)?)); } ((ty, _id), false) => p.skip(ty)?, ((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from( ::fbthrift::ApplicationException::new( ::fbthrift::ApplicationExceptionErrorCode::ProtocolError, format!( "unwanted extra union {} field ty {:?} id {}", "GetDataByIdError", badty, badid, ), ) )), } p.read_field_end()?; } p.read_struct_end()?; alt.ok_or_else(|| ::fbthrift::ApplicationException::new( ::fbthrift::ApplicationExceptionErrorCode::MissingResult, format!("Empty union {}", "GetDataByIdError"), ) .into(), ) } } pub type PutDataByIdError = ::fbthrift::NonthrowingFunctionError; impl ::std::convert::From for PutDataByIdError { fn from(e: crate::services::my_service::PutDataByIdExn) -> Self { match e { crate::services::my_service::PutDataByIdExn::ApplicationException(aexn) => PutDataByIdError::ApplicationException(aexn), } } } #[doc(hidden)] pub enum PutDataByIdReader {} impl ::fbthrift::help::DeserializeExn for PutDataByIdReader { type Success = (); type Error = PutDataByIdError; fn read_result

(p: &mut P) -> ::anyhow::Result<::std::result::Result> where P: ::fbthrift::ProtocolReader, { static RETURNS: &[::fbthrift::Field] = &[ ::fbthrift::Field::new("Success", ::fbthrift::TType::Void, 0), ]; let _ = p.read_struct_begin(|_| ())?; let mut once = false; let mut alt = ::std::result::Result::Ok(()); loop { let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?; match ((fty, fid as ::std::primitive::i32), once) { ((::fbthrift::TType::Stop, _), _) => { p.read_field_end()?; break; } ((::fbthrift::TType::Void, 0i32), false) => { once = true; alt = ::std::result::Result::Ok(::fbthrift::Deserialize::read(p)?); } ((ty, _id), false) => p.skip(ty)?, ((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from( ::fbthrift::ApplicationException::new( ::fbthrift::ApplicationExceptionErrorCode::ProtocolError, format!( "unwanted extra union {} field ty {:?} id {}", "PutDataByIdError", badty, badid, ), ) )), } p.read_field_end()?; } p.read_struct_end()?; ::std::result::Result::Ok(alt) } } pub type LobDataByIdError = ::fbthrift::NonthrowingFunctionError; impl ::std::convert::From for LobDataByIdError { fn from(e: crate::services::my_service::LobDataByIdExn) -> Self { match e { crate::services::my_service::LobDataByIdExn::ApplicationException(aexn) => LobDataByIdError::ApplicationException(aexn), } } } #[doc(hidden)] pub enum LobDataByIdReader {} impl ::fbthrift::help::DeserializeExn for LobDataByIdReader { type Success = (); type Error = LobDataByIdError; fn read_result

(p: &mut P) -> ::anyhow::Result<::std::result::Result> where P: ::fbthrift::ProtocolReader, { static RETURNS: &[::fbthrift::Field] = &[ ::fbthrift::Field::new("Success", ::fbthrift::TType::Void, 0), ]; let _ = p.read_struct_begin(|_| ())?; let mut once = false; let mut alt = ::std::result::Result::Ok(()); loop { let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?; match ((fty, fid as ::std::primitive::i32), once) { ((::fbthrift::TType::Stop, _), _) => { p.read_field_end()?; break; } ((::fbthrift::TType::Void, 0i32), false) => { once = true; alt = ::std::result::Result::Ok(::fbthrift::Deserialize::read(p)?); } ((ty, _id), false) => p.skip(ty)?, ((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from( ::fbthrift::ApplicationException::new( ::fbthrift::ApplicationExceptionErrorCode::ProtocolError, format!( "unwanted extra union {} field ty {:?} id {}", "LobDataByIdError", badty, badid, ), ) )), } p.read_field_end()?; } p.read_struct_end()?; ::std::result::Result::Ok(alt) } } pub type DoNothingError = ::fbthrift::NonthrowingFunctionError; impl ::std::convert::From for DoNothingError { fn from(e: crate::services::my_service::DoNothingExn) -> Self { match e { crate::services::my_service::DoNothingExn::ApplicationException(aexn) => DoNothingError::ApplicationException(aexn), } } } #[doc(hidden)] pub enum DoNothingReader {} impl ::fbthrift::help::DeserializeExn for DoNothingReader { type Success = (); type Error = DoNothingError; fn read_result

(p: &mut P) -> ::anyhow::Result<::std::result::Result> where P: ::fbthrift::ProtocolReader, { static RETURNS: &[::fbthrift::Field] = &[ ::fbthrift::Field::new("Success", ::fbthrift::TType::Void, 0), ]; let _ = p.read_struct_begin(|_| ())?; let mut once = false; let mut alt = ::std::result::Result::Ok(()); loop { let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?; match ((fty, fid as ::std::primitive::i32), once) { ((::fbthrift::TType::Stop, _), _) => { p.read_field_end()?; break; } ((::fbthrift::TType::Void, 0i32), false) => { once = true; alt = ::std::result::Result::Ok(::fbthrift::Deserialize::read(p)?); } ((ty, _id), false) => p.skip(ty)?, ((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from( ::fbthrift::ApplicationException::new( ::fbthrift::ApplicationExceptionErrorCode::ProtocolError, format!( "unwanted extra union {} field ty {:?} id {}", "DoNothingError", badty, badid, ), ) )), } p.read_field_end()?; } p.read_struct_end()?; ::std::result::Result::Ok(alt) } } } /// Error definitions for `MyServicePrioParent`. pub mod my_service_prio_parent { pub type PingError = ::fbthrift::NonthrowingFunctionError; impl ::std::convert::From for PingError { fn from(e: crate::services::my_service_prio_parent::PingExn) -> Self { match e { crate::services::my_service_prio_parent::PingExn::ApplicationException(aexn) => PingError::ApplicationException(aexn), } } } #[doc(hidden)] pub enum PingReader {} impl ::fbthrift::help::DeserializeExn for PingReader { type Success = (); type Error = PingError; fn read_result

(p: &mut P) -> ::anyhow::Result<::std::result::Result> where P: ::fbthrift::ProtocolReader, { static RETURNS: &[::fbthrift::Field] = &[ ::fbthrift::Field::new("Success", ::fbthrift::TType::Void, 0), ]; let _ = p.read_struct_begin(|_| ())?; let mut once = false; let mut alt = ::std::result::Result::Ok(()); loop { let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?; match ((fty, fid as ::std::primitive::i32), once) { ((::fbthrift::TType::Stop, _), _) => { p.read_field_end()?; break; } ((::fbthrift::TType::Void, 0i32), false) => { once = true; alt = ::std::result::Result::Ok(::fbthrift::Deserialize::read(p)?); } ((ty, _id), false) => p.skip(ty)?, ((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from( ::fbthrift::ApplicationException::new( ::fbthrift::ApplicationExceptionErrorCode::ProtocolError, format!( "unwanted extra union {} field ty {:?} id {}", "PingError", badty, badid, ), ) )), } p.read_field_end()?; } p.read_struct_end()?; ::std::result::Result::Ok(alt) } } pub type PongError = ::fbthrift::NonthrowingFunctionError; impl ::std::convert::From for PongError { fn from(e: crate::services::my_service_prio_parent::PongExn) -> Self { match e { crate::services::my_service_prio_parent::PongExn::ApplicationException(aexn) => PongError::ApplicationException(aexn), } } } #[doc(hidden)] pub enum PongReader {} impl ::fbthrift::help::DeserializeExn for PongReader { type Success = (); type Error = PongError; fn read_result

(p: &mut P) -> ::anyhow::Result<::std::result::Result> where P: ::fbthrift::ProtocolReader, { static RETURNS: &[::fbthrift::Field] = &[ ::fbthrift::Field::new("Success", ::fbthrift::TType::Void, 0), ]; let _ = p.read_struct_begin(|_| ())?; let mut once = false; let mut alt = ::std::result::Result::Ok(()); loop { let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?; match ((fty, fid as ::std::primitive::i32), once) { ((::fbthrift::TType::Stop, _), _) => { p.read_field_end()?; break; } ((::fbthrift::TType::Void, 0i32), false) => { once = true; alt = ::std::result::Result::Ok(::fbthrift::Deserialize::read(p)?); } ((ty, _id), false) => p.skip(ty)?, ((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from( ::fbthrift::ApplicationException::new( ::fbthrift::ApplicationExceptionErrorCode::ProtocolError, format!( "unwanted extra union {} field ty {:?} id {}", "PongError", badty, badid, ), ) )), } p.read_field_end()?; } p.read_struct_end()?; ::std::result::Result::Ok(alt) } } } /// Error definitions for `MyServicePrioChild`. pub mod my_service_prio_child { pub type PangError = ::fbthrift::NonthrowingFunctionError; impl ::std::convert::From for PangError { fn from(e: crate::services::my_service_prio_child::PangExn) -> Self { match e { crate::services::my_service_prio_child::PangExn::ApplicationException(aexn) => PangError::ApplicationException(aexn), } } } #[doc(hidden)] pub enum PangReader {} impl ::fbthrift::help::DeserializeExn for PangReader { type Success = (); type Error = PangError; fn read_result

(p: &mut P) -> ::anyhow::Result<::std::result::Result> where P: ::fbthrift::ProtocolReader, { static RETURNS: &[::fbthrift::Field] = &[ ::fbthrift::Field::new("Success", ::fbthrift::TType::Void, 0), ]; let _ = p.read_struct_begin(|_| ())?; let mut once = false; let mut alt = ::std::result::Result::Ok(()); loop { let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?; match ((fty, fid as ::std::primitive::i32), once) { ((::fbthrift::TType::Stop, _), _) => { p.read_field_end()?; break; } ((::fbthrift::TType::Void, 0i32), false) => { once = true; alt = ::std::result::Result::Ok(::fbthrift::Deserialize::read(p)?); } ((ty, _id), false) => p.skip(ty)?, ((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from( ::fbthrift::ApplicationException::new( ::fbthrift::ApplicationExceptionErrorCode::ProtocolError, format!( "unwanted extra union {} field ty {:?} id {}", "PangError", badty, badid, ), ) )), } p.read_field_end()?; } p.read_struct_end()?; ::std::result::Result::Ok(alt) } } } /// Error definitions for `BadInteraction`. pub mod bad_interaction { pub type FooError = ::fbthrift::NonthrowingFunctionError; impl ::std::convert::From for FooError { fn from(e: crate::services::bad_interaction::FooExn) -> Self { match e { crate::services::bad_interaction::FooExn::ApplicationException(aexn) => FooError::ApplicationException(aexn), } } } #[doc(hidden)] pub enum FooReader {} impl ::fbthrift::help::DeserializeExn for FooReader { type Success = (); type Error = FooError; fn read_result

(p: &mut P) -> ::anyhow::Result<::std::result::Result> where P: ::fbthrift::ProtocolReader, { static RETURNS: &[::fbthrift::Field] = &[ ::fbthrift::Field::new("Success", ::fbthrift::TType::Void, 0), ]; let _ = p.read_struct_begin(|_| ())?; let mut once = false; let mut alt = ::std::result::Result::Ok(()); loop { let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?; match ((fty, fid as ::std::primitive::i32), once) { ((::fbthrift::TType::Stop, _), _) => { p.read_field_end()?; break; } ((::fbthrift::TType::Void, 0i32), false) => { once = true; alt = ::std::result::Result::Ok(::fbthrift::Deserialize::read(p)?); } ((ty, _id), false) => p.skip(ty)?, ((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from( ::fbthrift::ApplicationException::new( ::fbthrift::ApplicationExceptionErrorCode::ProtocolError, format!( "unwanted extra union {} field ty {:?} id {}", "FooError", badty, badid, ), ) )), } p.read_field_end()?; } p.read_struct_end()?; ::std::result::Result::Ok(alt) } } } /// Error definitions for `BadService`. pub mod bad_service { pub type BarError = ::fbthrift::NonthrowingFunctionError; impl ::std::convert::From for BarError { fn from(e: crate::services::bad_service::BarExn) -> Self { match e { crate::services::bad_service::BarExn::ApplicationException(aexn) => BarError::ApplicationException(aexn), } } } #[doc(hidden)] pub enum BarReader {} impl ::fbthrift::help::DeserializeExn for BarReader { type Success = ::std::primitive::i32; type Error = BarError; fn read_result

(p: &mut P) -> ::anyhow::Result<::std::result::Result> where P: ::fbthrift::ProtocolReader, { static RETURNS: &[::fbthrift::Field] = &[ ::fbthrift::Field::new("Success", ::fbthrift::TType::I32, 0), ]; let _ = p.read_struct_begin(|_| ())?; let mut once = false; let mut alt = ::std::option::Option::None; loop { let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?; match ((fty, fid as ::std::primitive::i32), once) { ((::fbthrift::TType::Stop, _), _) => { p.read_field_end()?; break; } ((::fbthrift::TType::I32, 0i32), false) => { once = true; alt = ::std::option::Option::Some(::std::result::Result::Ok(::fbthrift::Deserialize::read(p)?)); } ((ty, _id), false) => p.skip(ty)?, ((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from( ::fbthrift::ApplicationException::new( ::fbthrift::ApplicationExceptionErrorCode::ProtocolError, format!( "unwanted extra union {} field ty {:?} id {}", "BarError", badty, badid, ), ) )), } p.read_field_end()?; } p.read_struct_end()?; alt.ok_or_else(|| ::fbthrift::ApplicationException::new( ::fbthrift::ApplicationExceptionErrorCode::MissingResult, format!("Empty union {}", "BarError"), ) .into(), ) } } } /// Error definitions for `FooBarBazService`. pub mod foo_bar_baz_service { pub type FooError = ::fbthrift::NonthrowingFunctionError; impl ::std::convert::From for FooError { fn from(e: crate::services::foo_bar_baz_service::FooExn) -> Self { match e { crate::services::foo_bar_baz_service::FooExn::ApplicationException(aexn) => FooError::ApplicationException(aexn), } } } #[doc(hidden)] pub enum FooReader {} impl ::fbthrift::help::DeserializeExn for FooReader { type Success = (); type Error = FooError; fn read_result

(p: &mut P) -> ::anyhow::Result<::std::result::Result> where P: ::fbthrift::ProtocolReader, { static RETURNS: &[::fbthrift::Field] = &[ ::fbthrift::Field::new("Success", ::fbthrift::TType::Void, 0), ]; let _ = p.read_struct_begin(|_| ())?; let mut once = false; let mut alt = ::std::result::Result::Ok(()); loop { let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?; match ((fty, fid as ::std::primitive::i32), once) { ((::fbthrift::TType::Stop, _), _) => { p.read_field_end()?; break; } ((::fbthrift::TType::Void, 0i32), false) => { once = true; alt = ::std::result::Result::Ok(::fbthrift::Deserialize::read(p)?); } ((ty, _id), false) => p.skip(ty)?, ((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from( ::fbthrift::ApplicationException::new( ::fbthrift::ApplicationExceptionErrorCode::ProtocolError, format!( "unwanted extra union {} field ty {:?} id {}", "FooError", badty, badid, ), ) )), } p.read_field_end()?; } p.read_struct_end()?; ::std::result::Result::Ok(alt) } } pub type BarError = ::fbthrift::NonthrowingFunctionError; impl ::std::convert::From for BarError { fn from(e: crate::services::foo_bar_baz_service::BarExn) -> Self { match e { crate::services::foo_bar_baz_service::BarExn::ApplicationException(aexn) => BarError::ApplicationException(aexn), } } } #[doc(hidden)] pub enum BarReader {} impl ::fbthrift::help::DeserializeExn for BarReader { type Success = (); type Error = BarError; fn read_result

(p: &mut P) -> ::anyhow::Result<::std::result::Result> where P: ::fbthrift::ProtocolReader, { static RETURNS: &[::fbthrift::Field] = &[ ::fbthrift::Field::new("Success", ::fbthrift::TType::Void, 0), ]; let _ = p.read_struct_begin(|_| ())?; let mut once = false; let mut alt = ::std::result::Result::Ok(()); loop { let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?; match ((fty, fid as ::std::primitive::i32), once) { ((::fbthrift::TType::Stop, _), _) => { p.read_field_end()?; break; } ((::fbthrift::TType::Void, 0i32), false) => { once = true; alt = ::std::result::Result::Ok(::fbthrift::Deserialize::read(p)?); } ((ty, _id), false) => p.skip(ty)?, ((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from( ::fbthrift::ApplicationException::new( ::fbthrift::ApplicationExceptionErrorCode::ProtocolError, format!( "unwanted extra union {} field ty {:?} id {}", "BarError", badty, badid, ), ) )), } p.read_field_end()?; } p.read_struct_end()?; ::std::result::Result::Ok(alt) } } pub type BazError = ::fbthrift::NonthrowingFunctionError; impl ::std::convert::From for BazError { fn from(e: crate::services::foo_bar_baz_service::BazExn) -> Self { match e { crate::services::foo_bar_baz_service::BazExn::ApplicationException(aexn) => BazError::ApplicationException(aexn), } } } #[doc(hidden)] pub enum BazReader {} impl ::fbthrift::help::DeserializeExn for BazReader { type Success = (); type Error = BazError; fn read_result

(p: &mut P) -> ::anyhow::Result<::std::result::Result> where P: ::fbthrift::ProtocolReader, { static RETURNS: &[::fbthrift::Field] = &[ ::fbthrift::Field::new("Success", ::fbthrift::TType::Void, 0), ]; let _ = p.read_struct_begin(|_| ())?; let mut once = false; let mut alt = ::std::result::Result::Ok(()); loop { let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?; match ((fty, fid as ::std::primitive::i32), once) { ((::fbthrift::TType::Stop, _), _) => { p.read_field_end()?; break; } ((::fbthrift::TType::Void, 0i32), false) => { once = true; alt = ::std::result::Result::Ok(::fbthrift::Deserialize::read(p)?); } ((ty, _id), false) => p.skip(ty)?, ((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from( ::fbthrift::ApplicationException::new( ::fbthrift::ApplicationExceptionErrorCode::ProtocolError, format!( "unwanted extra union {} field ty {:?} id {}", "BazError", badty, badid, ), ) )), } p.read_field_end()?; } p.read_struct_end()?; ::std::result::Result::Ok(alt) } } }