// @generated by Thrift for thrift/compiler/test/fixtures/rust-noserver/src/module.thrift // This file is probably not the place you want to edit! //! Thrift service definitions for `module`. /// Service definitions for `MyService`. pub mod my_service { #[derive(Clone, Debug)] pub enum PingExn { #[doc(hidden)] Success(()), ApplicationException(::fbthrift::ApplicationException), } impl ::std::convert::From for PingExn { fn from(err: crate::errors::my_service::PingError) -> Self { match err { crate::errors::my_service::PingError::ApplicationException(aexn) => PingExn::ApplicationException(aexn), crate::errors::my_service::PingError::ThriftError(err) => PingExn::ApplicationException(::fbthrift::ApplicationException { message: err.to_string(), type_: ::fbthrift::ApplicationExceptionErrorCode::InternalError, }), } } } impl ::std::convert::From<::fbthrift::ApplicationException> for PingExn { fn from(exn: ::fbthrift::ApplicationException) -> Self { Self::ApplicationException(exn) } } impl ::fbthrift::ExceptionInfo for PingExn { fn exn_name(&self) -> &'static str { match self { Self::Success(_) => panic!("ExceptionInfo::exn_name called on Success"), Self::ApplicationException(aexn) => aexn.exn_name(), } } fn exn_value(&self) -> String { match self { Self::Success(_) => panic!("ExceptionInfo::exn_value called on Success"), Self::ApplicationException(aexn) => aexn.exn_value(), } } fn exn_is_declared(&self) -> bool { match self { Self::Success(_) => panic!("ExceptionInfo::exn_is_declared called on Success"), Self::ApplicationException(aexn) => aexn.exn_is_declared(), } } } impl ::fbthrift::ResultInfo for PingExn { fn result_type(&self) -> ::fbthrift::ResultType { match self { Self::Success(_) => ::fbthrift::ResultType::Return, Self::ApplicationException(_aexn) => ::fbthrift::ResultType::Exception, } } } impl ::fbthrift::GetTType for PingExn { const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct; } impl

::fbthrift::Serialize

for PingExn where P: ::fbthrift::ProtocolWriter, { fn write(&self, p: &mut P) { if let Self::ApplicationException(aexn) = self { return aexn.write(p); } p.write_struct_begin("Ping"); match self { Self::Success(inner) => { p.write_field_begin( "Success", ::fbthrift::TType::Void, 0i16, ); inner.write(p); p.write_field_end(); } Self::ApplicationException(_aexn) => unreachable!(), } p.write_field_stop(); p.write_struct_end(); } } impl

::fbthrift::Deserialize

for PingExn where P: ::fbthrift::ProtocolReader, { fn read(p: &mut P) -> ::anyhow::Result { static RETURNS: &[::fbthrift::Field] = &[ ::fbthrift::Field::new("Success", ::fbthrift::TType::Void, 0), ]; let _ = p.read_struct_begin(|_| ())?; let mut once = false; let mut alt = Self::Success(()); 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 = Self::Success(::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 {}", "PingExn", badty, badid, ), ) )), } p.read_field_end()?; } p.read_struct_end()?; ::std::result::Result::Ok(alt) } } #[derive(Clone, Debug)] pub enum GetRandomDataExn { #[doc(hidden)] Success(::std::string::String), ApplicationException(::fbthrift::ApplicationException), } impl ::std::convert::From for GetRandomDataExn { fn from(err: crate::errors::my_service::GetRandomDataError) -> Self { match err { crate::errors::my_service::GetRandomDataError::ApplicationException(aexn) => GetRandomDataExn::ApplicationException(aexn), crate::errors::my_service::GetRandomDataError::ThriftError(err) => GetRandomDataExn::ApplicationException(::fbthrift::ApplicationException { message: err.to_string(), type_: ::fbthrift::ApplicationExceptionErrorCode::InternalError, }), } } } impl ::std::convert::From<::fbthrift::ApplicationException> for GetRandomDataExn { fn from(exn: ::fbthrift::ApplicationException) -> Self { Self::ApplicationException(exn) } } impl ::fbthrift::ExceptionInfo for GetRandomDataExn { fn exn_name(&self) -> &'static str { match self { Self::Success(_) => panic!("ExceptionInfo::exn_name called on Success"), Self::ApplicationException(aexn) => aexn.exn_name(), } } fn exn_value(&self) -> String { match self { Self::Success(_) => panic!("ExceptionInfo::exn_value called on Success"), Self::ApplicationException(aexn) => aexn.exn_value(), } } fn exn_is_declared(&self) -> bool { match self { Self::Success(_) => panic!("ExceptionInfo::exn_is_declared called on Success"), Self::ApplicationException(aexn) => aexn.exn_is_declared(), } } } impl ::fbthrift::ResultInfo for GetRandomDataExn { fn result_type(&self) -> ::fbthrift::ResultType { match self { Self::Success(_) => ::fbthrift::ResultType::Return, Self::ApplicationException(_aexn) => ::fbthrift::ResultType::Exception, } } } impl ::fbthrift::GetTType for GetRandomDataExn { const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct; } impl

::fbthrift::Serialize

for GetRandomDataExn where P: ::fbthrift::ProtocolWriter, { fn write(&self, p: &mut P) { if let Self::ApplicationException(aexn) = self { return aexn.write(p); } p.write_struct_begin("GetRandomData"); match self { Self::Success(inner) => { p.write_field_begin( "Success", ::fbthrift::TType::String, 0i16, ); inner.write(p); p.write_field_end(); } Self::ApplicationException(_aexn) => unreachable!(), } p.write_field_stop(); p.write_struct_end(); } } impl

::fbthrift::Deserialize

for GetRandomDataExn where P: ::fbthrift::ProtocolReader, { fn read(p: &mut P) -> ::anyhow::Result { 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(Self::Success(::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 {}", "GetRandomDataExn", badty, badid, ), ) )), } p.read_field_end()?; } p.read_struct_end()?; alt.ok_or_else(|| ::fbthrift::ApplicationException::new( ::fbthrift::ApplicationExceptionErrorCode::MissingResult, format!("Empty union {}", "GetRandomDataExn"), ) .into(), ) } } #[derive(Clone, Debug)] pub enum HasDataByIdExn { #[doc(hidden)] Success(::std::primitive::bool), ApplicationException(::fbthrift::ApplicationException), } impl ::std::convert::From for HasDataByIdExn { fn from(err: crate::errors::my_service::HasDataByIdError) -> Self { match err { crate::errors::my_service::HasDataByIdError::ApplicationException(aexn) => HasDataByIdExn::ApplicationException(aexn), crate::errors::my_service::HasDataByIdError::ThriftError(err) => HasDataByIdExn::ApplicationException(::fbthrift::ApplicationException { message: err.to_string(), type_: ::fbthrift::ApplicationExceptionErrorCode::InternalError, }), } } } impl ::std::convert::From<::fbthrift::ApplicationException> for HasDataByIdExn { fn from(exn: ::fbthrift::ApplicationException) -> Self { Self::ApplicationException(exn) } } impl ::fbthrift::ExceptionInfo for HasDataByIdExn { fn exn_name(&self) -> &'static str { match self { Self::Success(_) => panic!("ExceptionInfo::exn_name called on Success"), Self::ApplicationException(aexn) => aexn.exn_name(), } } fn exn_value(&self) -> String { match self { Self::Success(_) => panic!("ExceptionInfo::exn_value called on Success"), Self::ApplicationException(aexn) => aexn.exn_value(), } } fn exn_is_declared(&self) -> bool { match self { Self::Success(_) => panic!("ExceptionInfo::exn_is_declared called on Success"), Self::ApplicationException(aexn) => aexn.exn_is_declared(), } } } impl ::fbthrift::ResultInfo for HasDataByIdExn { fn result_type(&self) -> ::fbthrift::ResultType { match self { Self::Success(_) => ::fbthrift::ResultType::Return, Self::ApplicationException(_aexn) => ::fbthrift::ResultType::Exception, } } } impl ::fbthrift::GetTType for HasDataByIdExn { const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct; } impl

::fbthrift::Serialize

for HasDataByIdExn where P: ::fbthrift::ProtocolWriter, { fn write(&self, p: &mut P) { if let Self::ApplicationException(aexn) = self { return aexn.write(p); } p.write_struct_begin("HasDataById"); match self { Self::Success(inner) => { p.write_field_begin( "Success", ::fbthrift::TType::Bool, 0i16, ); inner.write(p); p.write_field_end(); } Self::ApplicationException(_aexn) => unreachable!(), } p.write_field_stop(); p.write_struct_end(); } } impl

::fbthrift::Deserialize

for HasDataByIdExn where P: ::fbthrift::ProtocolReader, { fn read(p: &mut P) -> ::anyhow::Result { 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(Self::Success(::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 {}", "HasDataByIdExn", badty, badid, ), ) )), } p.read_field_end()?; } p.read_struct_end()?; alt.ok_or_else(|| ::fbthrift::ApplicationException::new( ::fbthrift::ApplicationExceptionErrorCode::MissingResult, format!("Empty union {}", "HasDataByIdExn"), ) .into(), ) } } #[derive(Clone, Debug)] pub enum GetDataByIdExn { #[doc(hidden)] Success(::std::string::String), ApplicationException(::fbthrift::ApplicationException), } impl ::std::convert::From for GetDataByIdExn { fn from(err: crate::errors::my_service::GetDataByIdError) -> Self { match err { crate::errors::my_service::GetDataByIdError::ApplicationException(aexn) => GetDataByIdExn::ApplicationException(aexn), crate::errors::my_service::GetDataByIdError::ThriftError(err) => GetDataByIdExn::ApplicationException(::fbthrift::ApplicationException { message: err.to_string(), type_: ::fbthrift::ApplicationExceptionErrorCode::InternalError, }), } } } impl ::std::convert::From<::fbthrift::ApplicationException> for GetDataByIdExn { fn from(exn: ::fbthrift::ApplicationException) -> Self { Self::ApplicationException(exn) } } impl ::fbthrift::ExceptionInfo for GetDataByIdExn { fn exn_name(&self) -> &'static str { match self { Self::Success(_) => panic!("ExceptionInfo::exn_name called on Success"), Self::ApplicationException(aexn) => aexn.exn_name(), } } fn exn_value(&self) -> String { match self { Self::Success(_) => panic!("ExceptionInfo::exn_value called on Success"), Self::ApplicationException(aexn) => aexn.exn_value(), } } fn exn_is_declared(&self) -> bool { match self { Self::Success(_) => panic!("ExceptionInfo::exn_is_declared called on Success"), Self::ApplicationException(aexn) => aexn.exn_is_declared(), } } } impl ::fbthrift::ResultInfo for GetDataByIdExn { fn result_type(&self) -> ::fbthrift::ResultType { match self { Self::Success(_) => ::fbthrift::ResultType::Return, Self::ApplicationException(_aexn) => ::fbthrift::ResultType::Exception, } } } impl ::fbthrift::GetTType for GetDataByIdExn { const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct; } impl

::fbthrift::Serialize

for GetDataByIdExn where P: ::fbthrift::ProtocolWriter, { fn write(&self, p: &mut P) { if let Self::ApplicationException(aexn) = self { return aexn.write(p); } p.write_struct_begin("GetDataById"); match self { Self::Success(inner) => { p.write_field_begin( "Success", ::fbthrift::TType::String, 0i16, ); inner.write(p); p.write_field_end(); } Self::ApplicationException(_aexn) => unreachable!(), } p.write_field_stop(); p.write_struct_end(); } } impl

::fbthrift::Deserialize

for GetDataByIdExn where P: ::fbthrift::ProtocolReader, { fn read(p: &mut P) -> ::anyhow::Result { 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(Self::Success(::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 {}", "GetDataByIdExn", badty, badid, ), ) )), } p.read_field_end()?; } p.read_struct_end()?; alt.ok_or_else(|| ::fbthrift::ApplicationException::new( ::fbthrift::ApplicationExceptionErrorCode::MissingResult, format!("Empty union {}", "GetDataByIdExn"), ) .into(), ) } } #[derive(Clone, Debug)] pub enum PutDataByIdExn { #[doc(hidden)] Success(()), ApplicationException(::fbthrift::ApplicationException), } impl ::std::convert::From for PutDataByIdExn { fn from(err: crate::errors::my_service::PutDataByIdError) -> Self { match err { crate::errors::my_service::PutDataByIdError::ApplicationException(aexn) => PutDataByIdExn::ApplicationException(aexn), crate::errors::my_service::PutDataByIdError::ThriftError(err) => PutDataByIdExn::ApplicationException(::fbthrift::ApplicationException { message: err.to_string(), type_: ::fbthrift::ApplicationExceptionErrorCode::InternalError, }), } } } impl ::std::convert::From<::fbthrift::ApplicationException> for PutDataByIdExn { fn from(exn: ::fbthrift::ApplicationException) -> Self { Self::ApplicationException(exn) } } impl ::fbthrift::ExceptionInfo for PutDataByIdExn { fn exn_name(&self) -> &'static str { match self { Self::Success(_) => panic!("ExceptionInfo::exn_name called on Success"), Self::ApplicationException(aexn) => aexn.exn_name(), } } fn exn_value(&self) -> String { match self { Self::Success(_) => panic!("ExceptionInfo::exn_value called on Success"), Self::ApplicationException(aexn) => aexn.exn_value(), } } fn exn_is_declared(&self) -> bool { match self { Self::Success(_) => panic!("ExceptionInfo::exn_is_declared called on Success"), Self::ApplicationException(aexn) => aexn.exn_is_declared(), } } } impl ::fbthrift::ResultInfo for PutDataByIdExn { fn result_type(&self) -> ::fbthrift::ResultType { match self { Self::Success(_) => ::fbthrift::ResultType::Return, Self::ApplicationException(_aexn) => ::fbthrift::ResultType::Exception, } } } impl ::fbthrift::GetTType for PutDataByIdExn { const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct; } impl

::fbthrift::Serialize

for PutDataByIdExn where P: ::fbthrift::ProtocolWriter, { fn write(&self, p: &mut P) { if let Self::ApplicationException(aexn) = self { return aexn.write(p); } p.write_struct_begin("PutDataById"); match self { Self::Success(inner) => { p.write_field_begin( "Success", ::fbthrift::TType::Void, 0i16, ); inner.write(p); p.write_field_end(); } Self::ApplicationException(_aexn) => unreachable!(), } p.write_field_stop(); p.write_struct_end(); } } impl

::fbthrift::Deserialize

for PutDataByIdExn where P: ::fbthrift::ProtocolReader, { fn read(p: &mut P) -> ::anyhow::Result { static RETURNS: &[::fbthrift::Field] = &[ ::fbthrift::Field::new("Success", ::fbthrift::TType::Void, 0), ]; let _ = p.read_struct_begin(|_| ())?; let mut once = false; let mut alt = Self::Success(()); 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 = Self::Success(::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 {}", "PutDataByIdExn", badty, badid, ), ) )), } p.read_field_end()?; } p.read_struct_end()?; ::std::result::Result::Ok(alt) } } #[derive(Clone, Debug)] pub enum LobDataByIdExn { #[doc(hidden)] Success(()), ApplicationException(::fbthrift::ApplicationException), } impl ::std::convert::From for LobDataByIdExn { fn from(err: crate::errors::my_service::LobDataByIdError) -> Self { match err { crate::errors::my_service::LobDataByIdError::ApplicationException(aexn) => LobDataByIdExn::ApplicationException(aexn), crate::errors::my_service::LobDataByIdError::ThriftError(err) => LobDataByIdExn::ApplicationException(::fbthrift::ApplicationException { message: err.to_string(), type_: ::fbthrift::ApplicationExceptionErrorCode::InternalError, }), } } } impl ::std::convert::From<::fbthrift::ApplicationException> for LobDataByIdExn { fn from(exn: ::fbthrift::ApplicationException) -> Self { Self::ApplicationException(exn) } } impl ::fbthrift::ExceptionInfo for LobDataByIdExn { fn exn_name(&self) -> &'static str { match self { Self::Success(_) => panic!("ExceptionInfo::exn_name called on Success"), Self::ApplicationException(aexn) => aexn.exn_name(), } } fn exn_value(&self) -> String { match self { Self::Success(_) => panic!("ExceptionInfo::exn_value called on Success"), Self::ApplicationException(aexn) => aexn.exn_value(), } } fn exn_is_declared(&self) -> bool { match self { Self::Success(_) => panic!("ExceptionInfo::exn_is_declared called on Success"), Self::ApplicationException(aexn) => aexn.exn_is_declared(), } } } impl ::fbthrift::ResultInfo for LobDataByIdExn { fn result_type(&self) -> ::fbthrift::ResultType { match self { Self::Success(_) => ::fbthrift::ResultType::Return, Self::ApplicationException(_aexn) => ::fbthrift::ResultType::Exception, } } } impl ::fbthrift::GetTType for LobDataByIdExn { const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct; } impl

::fbthrift::Serialize

for LobDataByIdExn where P: ::fbthrift::ProtocolWriter, { fn write(&self, p: &mut P) { if let Self::ApplicationException(aexn) = self { return aexn.write(p); } p.write_struct_begin("LobDataById"); match self { Self::Success(inner) => { p.write_field_begin( "Success", ::fbthrift::TType::Void, 0i16, ); inner.write(p); p.write_field_end(); } Self::ApplicationException(_aexn) => unreachable!(), } p.write_field_stop(); p.write_struct_end(); } } impl

::fbthrift::Deserialize

for LobDataByIdExn where P: ::fbthrift::ProtocolReader, { fn read(p: &mut P) -> ::anyhow::Result { static RETURNS: &[::fbthrift::Field] = &[ ::fbthrift::Field::new("Success", ::fbthrift::TType::Void, 0), ]; let _ = p.read_struct_begin(|_| ())?; let mut once = false; let mut alt = Self::Success(()); 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 = Self::Success(::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 {}", "LobDataByIdExn", badty, badid, ), ) )), } p.read_field_end()?; } p.read_struct_end()?; ::std::result::Result::Ok(alt) } } }