pub mod const_val {
#![allow(warnings, clippy::all)]
pub mod const_val {
impl ::std::convert::From<Index> for i32 {
fn from(e: Index) -> Self {
e as _
}
}
impl ::std::convert::TryFrom<i32> for Index {
type Error = ::pilota::EnumConvertError<i32>;
#[allow(non_upper_case_globals)]
fn try_from(v: i32) -> Result<Self, ::pilota::EnumConvertError<i32>> {
const A: i32 = Index::A as i32;
const B: i32 = Index::B as i32;
match v {
A => ::std::result::Result::Ok(Index::A),
B => ::std::result::Result::Ok(Index::B),
_ => ::std::result::Result::Err(::pilota::EnumConvertError::InvalidNum(
v, "Index",
)),
}
}
}
#[derive(PartialOrd, Hash, Eq, Ord, Debug, :: pilota :: derivative :: Derivative)]
#[derivative(Default)]
#[derive(Clone, PartialEq)]
#[repr(i32)]
#[derive(Copy)]
pub enum Index {
#[derivative(Default)]
A = 0i32,
B = 1i32,
}
#[::async_trait::async_trait]
impl ::pilota::thrift::Message for Index {
fn encode<T: ::pilota::thrift::TOutputProtocol>(
&self,
protocol: &mut T,
) -> ::std::result::Result<(), ::pilota::thrift::Error> {
protocol.write_i32(*self as i32)?;
Ok(())
}
fn decode<T: ::pilota::thrift::TInputProtocol>(
protocol: &mut T,
) -> ::std::result::Result<Self, ::pilota::thrift::Error> {
let value = protocol.read_i32()?;
Ok(Self::try_from(value).map_err(|err| {
::pilota::thrift::new_protocol_error(
::pilota::thrift::ProtocolErrorKind::InvalidData,
format!("invalid enum value for Index, value: {}", value),
)
})?)
}
async fn decode_async<C: ::tokio::io::AsyncRead + Unpin + Send>(
protocol: &mut ::pilota::thrift::TAsyncBinaryProtocol<C>,
) -> ::std::result::Result<Self, ::pilota::thrift::Error> {
let value = protocol.read_i32().await?;
Ok(Self::try_from(value).map_err(|err| {
::pilota::thrift::new_protocol_error(
::pilota::thrift::ProtocolErrorKind::InvalidData,
format!("invalid enum value for Index, value: {}", value),
)
})?)
}
fn size<T: ::pilota::thrift::TLengthProtocol>(&self, protocol: &mut T) -> usize {
protocol.write_i32_len(*self as i32)
}
}
::pilota::lazy_static::lazy_static! { pub static ref TEST_MAP : :: std :: collections :: HashMap < Index , & 'static str > = { let mut map = :: std :: collections :: HashMap :: with_capacity (2usize) ; map . insert (Index :: A , "hello") ; map . insert (Index :: B , "world") ; map } ; }
pub const TEST_LIST: [&'static str; 2usize] = ["hello", "world"];
}
}