// @generated by Thrift for thrift/compiler/test/fixtures/doctext/src/module.thrift // This file is probably not the place you want to edit! //! Thrift service definitions for `module`. /// Service definitions for `C`. pub mod c { #![doc = "Detailed overview of service"] #[derive(Clone, Debug)] pub enum FExn { ApplicationException(::fbthrift::ApplicationException), } impl ::std::convert::From for FExn { fn from(err: crate::errors::c::FError) -> Self { match err { crate::errors::c::FError::ApplicationException(aexn) => FExn::ApplicationException(aexn), crate::errors::c::FError::ThriftError(err) => FExn::ApplicationException(::fbthrift::ApplicationException { message: err.to_string(), type_: ::fbthrift::ApplicationExceptionErrorCode::InternalError, }), } } } impl ::std::convert::From<::fbthrift::ApplicationException> for FExn { fn from(exn: ::fbthrift::ApplicationException) -> Self { Self::ApplicationException(exn) } } impl ::fbthrift::ExceptionInfo for FExn { fn exn_name(&self) -> &'static str { match self { Self::ApplicationException(aexn) => aexn.exn_name(), } } fn exn_value(&self) -> String { match self { Self::ApplicationException(aexn) => aexn.exn_value(), } } fn exn_is_declared(&self) -> bool { match self { Self::ApplicationException(aexn) => aexn.exn_is_declared(), } } } impl ::fbthrift::ResultInfo for FExn { fn result_type(&self) -> ::fbthrift::ResultType { match self { Self::ApplicationException(_aexn) => ::fbthrift::ResultType::Exception, } } } impl

::fbthrift::Serialize

for FExn where P: ::fbthrift::ProtocolWriter, { fn write(&self, p: &mut P) { ::fbthrift::help::SerializeExn::write_result(Err(self), p); } } impl ::fbthrift::help::SerializeExn for FExn { type Success = (); fn write_result

(res: ::std::result::Result<&Self::Success, &Self>, p: &mut P) where P: ::fbthrift::ProtocolWriter, { if let ::std::result::Result::Err(Self::ApplicationException(aexn)) = res { ::fbthrift::Serialize::write(aexn, p); return; } p.write_struct_begin("F"); match res { ::std::result::Result::Ok(_success) => { p.write_field_begin("Success", ::fbthrift::TType::Void, 0i16); ::fbthrift::Serialize::write(_success, p); p.write_field_end(); } ::std::result::Result::Err(Self::ApplicationException(_aexn)) => unreachable!(), } p.write_field_stop(); p.write_struct_end(); } } #[derive(Clone, Debug)] pub enum NumbersStreamExn { ApplicationException(::fbthrift::ApplicationException), } impl ::fbthrift::ExceptionInfo for NumbersStreamExn { fn exn_name(&self) -> &'static str { match self { Self::ApplicationException(aexn) => aexn.exn_name(), } } fn exn_value(&self) -> String { match self { Self::ApplicationException(aexn) => aexn.exn_value(), } } fn exn_is_declared(&self) -> bool { match self { Self::ApplicationException(aexn) => aexn.exn_is_declared(), } } } impl ::fbthrift::ResultInfo for NumbersStreamExn { fn result_type(&self) -> ::fbthrift::ResultType { match self { Self::ApplicationException(_aexn) => ::fbthrift::ResultType::Exception, } } } impl ::std::convert::From<::fbthrift::ApplicationException> for NumbersStreamExn { fn from(exn: ::fbthrift::ApplicationException) -> Self { Self::ApplicationException(exn) } } impl

::fbthrift::Serialize

for NumbersStreamExn where P: ::fbthrift::ProtocolWriter, { fn write(&self, p: &mut P) { ::fbthrift::help::SerializeExn::write_result(Err(self), p); } } impl ::fbthrift::help::SerializeExn for NumbersStreamExn { type Success = crate::types::number; fn write_result

(res: ::std::result::Result<&Self::Success, &Self>, p: &mut P) where P: ::fbthrift::ProtocolWriter, { if let ::std::result::Result::Err(Self::ApplicationException(aexn)) = res { ::fbthrift::Serialize::write(aexn, p); return; } p.write_struct_begin("Numbers"); match res { ::std::result::Result::Ok(success) => { p.write_field_begin( "Success", ::fbthrift::TType::I32, 0i16, ); ::fbthrift::Serialize::write(success, p); p.write_field_end(); } ::std::result::Result::Err(Self::ApplicationException(_)) => unreachable!(), } p.write_field_stop(); p.write_struct_end(); } } #[derive(Clone, Debug)] pub enum NumbersExn { ApplicationException(::fbthrift::ApplicationException), } impl ::std::convert::From for NumbersExn { fn from(err: crate::errors::c::NumbersError) -> Self { match err { crate::errors::c::NumbersError::ApplicationException(aexn) => NumbersExn::ApplicationException(aexn), crate::errors::c::NumbersError::ThriftError(err) => NumbersExn::ApplicationException(::fbthrift::ApplicationException { message: err.to_string(), type_: ::fbthrift::ApplicationExceptionErrorCode::InternalError, }), } } } impl ::std::convert::From<::fbthrift::ApplicationException> for NumbersExn { fn from(exn: ::fbthrift::ApplicationException) -> Self { Self::ApplicationException(exn) } } impl ::fbthrift::ExceptionInfo for NumbersExn { fn exn_name(&self) -> &'static str { match self { Self::ApplicationException(aexn) => aexn.exn_name(), } } fn exn_value(&self) -> String { match self { Self::ApplicationException(aexn) => aexn.exn_value(), } } fn exn_is_declared(&self) -> bool { match self { Self::ApplicationException(aexn) => aexn.exn_is_declared(), } } } impl ::fbthrift::ResultInfo for NumbersExn { fn result_type(&self) -> ::fbthrift::ResultType { match self { Self::ApplicationException(_aexn) => ::fbthrift::ResultType::Exception, } } } impl

::fbthrift::Serialize

for NumbersExn where P: ::fbthrift::ProtocolWriter, { fn write(&self, p: &mut P) { ::fbthrift::help::SerializeExn::write_result(Err(self), p); } } impl ::fbthrift::help::SerializeExn for NumbersExn { type Success = (); fn write_result

(res: ::std::result::Result<&Self::Success, &Self>, p: &mut P) where P: ::fbthrift::ProtocolWriter, { if let ::std::result::Result::Err(Self::ApplicationException(aexn)) = res { ::fbthrift::Serialize::write(aexn, p); return; } p.write_struct_begin("Numbers"); match res { ::std::result::Result::Ok(_success) => { p.write_field_begin("Success", ::fbthrift::TType::Void, 0i16); p.write_field_end(); } ::std::result::Result::Err(Self::ApplicationException(_aexn)) => unreachable!(), } p.write_field_stop(); p.write_struct_end(); } } #[derive(Clone, Debug)] pub enum ThingExn { bang(crate::types::Bang), ApplicationException(::fbthrift::ApplicationException), } impl ::std::convert::From for ThingExn { fn from(exn: crate::types::Bang) -> Self { Self::bang(exn) } } impl ::std::convert::From for ThingExn { fn from(err: crate::errors::c::ThingError) -> Self { match err { crate::errors::c::ThingError::bang(err) => ThingExn::bang(err), crate::errors::c::ThingError::ApplicationException(aexn) => ThingExn::ApplicationException(aexn), crate::errors::c::ThingError::ThriftError(err) => ThingExn::ApplicationException(::fbthrift::ApplicationException { message: err.to_string(), type_: ::fbthrift::ApplicationExceptionErrorCode::InternalError, }), } } } impl ::std::convert::From<::fbthrift::ApplicationException> for ThingExn { fn from(exn: ::fbthrift::ApplicationException) -> Self { Self::ApplicationException(exn) } } impl ::fbthrift::ExceptionInfo for ThingExn { fn exn_name(&self) -> &'static str { match self { Self::ApplicationException(aexn) => aexn.exn_name(), Self::bang(exn) => exn.exn_name(), } } fn exn_value(&self) -> String { match self { Self::ApplicationException(aexn) => aexn.exn_value(), Self::bang(exn) => exn.exn_value(), } } fn exn_is_declared(&self) -> bool { match self { Self::ApplicationException(aexn) => aexn.exn_is_declared(), Self::bang(exn) => exn.exn_is_declared(), } } } impl ::fbthrift::ResultInfo for ThingExn { fn result_type(&self) -> ::fbthrift::ResultType { match self { Self::ApplicationException(_aexn) => ::fbthrift::ResultType::Exception, Self::bang(_exn) => fbthrift::ResultType::Error, } } } impl

::fbthrift::Serialize

for ThingExn where P: ::fbthrift::ProtocolWriter, { fn write(&self, p: &mut P) { ::fbthrift::help::SerializeExn::write_result(Err(self), p); } } impl ::fbthrift::help::SerializeExn for ThingExn { type Success = ::std::string::String; fn write_result

(res: ::std::result::Result<&Self::Success, &Self>, p: &mut P) where P: ::fbthrift::ProtocolWriter, { if let ::std::result::Result::Err(Self::ApplicationException(aexn)) = res { ::fbthrift::Serialize::write(aexn, p); return; } p.write_struct_begin("Thing"); match res { ::std::result::Result::Ok(_success) => { p.write_field_begin("Success", ::fbthrift::TType::String, 0i16); ::fbthrift::Serialize::write(_success, p); p.write_field_end(); } ::std::result::Result::Err(Self::bang(inner)) => { p.write_field_begin( "bang", ::fbthrift::TType::Struct, 1, ); ::fbthrift::Serialize::write(inner, p); p.write_field_end(); } ::std::result::Result::Err(Self::ApplicationException(_aexn)) => unreachable!(), } p.write_field_stop(); p.write_struct_end(); } } }