pub mod pilota_name {
#![allow(warnings, clippy::all)]
pub mod pilota_name {
#[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)]
pub struct Test2 {
pub id: ::pilota::FastStr,
}
#[::async_trait::async_trait]
impl ::pilota::thrift::Message for Test2 {
fn encode<T: ::pilota::thrift::TOutputProtocol>(
&self,
protocol: &mut T,
) -> ::std::result::Result<(), ::pilota::thrift::Error> {
let struct_ident = ::pilota::thrift::TStructIdentifier { name: "TEST" };
protocol.write_struct_begin(&struct_ident)?;
{
let value = &self.id;
protocol.write_field_begin(::pilota::thrift::TType::Binary, 1i16)?;
protocol.write_faststr(value.clone())?;
protocol.write_field_end()?;
}
protocol.write_field_stop()?;
protocol.write_struct_end()?;
Ok(())
}
fn decode<T: ::pilota::thrift::TInputProtocol>(
protocol: &mut T,
) -> ::std::result::Result<Self, ::pilota::thrift::Error> {
let mut id = None;
protocol.read_struct_begin()?;
loop {
let field_ident = protocol.read_field_begin()?;
if field_ident.field_type == ::pilota::thrift::TType::Stop {
break;
}
let field_id = field_ident.id;
match field_id {
Some(1i16) if field_ident.field_type == ::pilota::thrift::TType::Binary => {
id = Some(protocol.read_faststr()?);
}
_ => {
protocol.skip(field_ident.field_type)?;
}
}
protocol.read_field_end()?;
}
protocol.read_struct_end()?;
let id = if let Some(id) = id {
id
} else {
return Err(::pilota::thrift::Error::Protocol(
::pilota::thrift::ProtocolError::new(
::pilota::thrift::ProtocolErrorKind::InvalidData,
"field id is required".to_string(),
),
));
};
let data = Self { id };
Ok(data)
}
async fn decode_async<C: ::tokio::io::AsyncRead + Unpin + Send>(
protocol: &mut ::pilota::thrift::TAsyncBinaryProtocol<C>,
) -> ::std::result::Result<Self, ::pilota::thrift::Error> {
let mut id = None;
protocol.read_struct_begin().await?;
loop {
let field_ident = protocol.read_field_begin().await?;
if field_ident.field_type == ::pilota::thrift::TType::Stop {
break;
}
let field_id = field_ident.id;
match field_id {
Some(1i16) if field_ident.field_type == ::pilota::thrift::TType::Binary => {
id = Some(protocol.read_faststr().await?);
}
_ => {
protocol.skip(field_ident.field_type).await?;
}
}
protocol.read_field_end().await?;
}
protocol.read_struct_end().await?;
let id = if let Some(id) = id {
id
} else {
return Err(::pilota::thrift::Error::Protocol(
::pilota::thrift::ProtocolError::new(
::pilota::thrift::ProtocolErrorKind::InvalidData,
"field id is required".to_string(),
),
));
};
let data = Self { id };
Ok(data)
}
fn size<T: ::pilota::thrift::TLengthProtocol>(&self, protocol: &mut T) -> usize {
protocol
.write_struct_begin_len(&::pilota::thrift::TStructIdentifier { name: "TEST" })
+ {
let value = &self.id;
protocol.write_field_begin_len(&::pilota::thrift::TFieldIdentifier {
name: Some("ID"),
field_type: ::pilota::thrift::TType::Binary,
id: Some(1i16),
}) + protocol.write_faststr_len(value)
+ protocol.write_field_end_len()
}
+ protocol.write_field_stop_len()
+ protocol.write_struct_end_len()
}
}
pub const LANG_ID: &'static str = "id";
#[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)]
pub struct Test1 {
pub id: ::pilota::FastStr,
pub hello: ::pilota::FastStr,
}
#[::async_trait::async_trait]
impl ::pilota::thrift::Message for Test1 {
fn encode<T: ::pilota::thrift::TOutputProtocol>(
&self,
protocol: &mut T,
) -> ::std::result::Result<(), ::pilota::thrift::Error> {
let struct_ident = ::pilota::thrift::TStructIdentifier { name: "Test" };
protocol.write_struct_begin(&struct_ident)?;
{
let value = &self.id;
protocol.write_field_begin(::pilota::thrift::TType::Binary, 1i16)?;
protocol.write_faststr(value.clone())?;
protocol.write_field_end()?;
}
{
let value = &self.hello;
protocol.write_field_begin(::pilota::thrift::TType::Binary, 2i16)?;
protocol.write_faststr(value.clone())?;
protocol.write_field_end()?;
}
protocol.write_field_stop()?;
protocol.write_struct_end()?;
Ok(())
}
fn decode<T: ::pilota::thrift::TInputProtocol>(
protocol: &mut T,
) -> ::std::result::Result<Self, ::pilota::thrift::Error> {
let mut id = None;
let mut hello = None;
protocol.read_struct_begin()?;
loop {
let field_ident = protocol.read_field_begin()?;
if field_ident.field_type == ::pilota::thrift::TType::Stop {
break;
}
let field_id = field_ident.id;
match field_id {
Some(1i16) if field_ident.field_type == ::pilota::thrift::TType::Binary => {
id = Some(protocol.read_faststr()?);
}
Some(2i16) if field_ident.field_type == ::pilota::thrift::TType::Binary => {
hello = Some(protocol.read_faststr()?);
}
_ => {
protocol.skip(field_ident.field_type)?;
}
}
protocol.read_field_end()?;
}
protocol.read_struct_end()?;
let id = if let Some(id) = id {
id
} else {
return Err(::pilota::thrift::Error::Protocol(
::pilota::thrift::ProtocolError::new(
::pilota::thrift::ProtocolErrorKind::InvalidData,
"field id is required".to_string(),
),
));
};
let hello = if let Some(hello) = hello {
hello
} else {
return Err(::pilota::thrift::Error::Protocol(
::pilota::thrift::ProtocolError::new(
::pilota::thrift::ProtocolErrorKind::InvalidData,
"field hello is required".to_string(),
),
));
};
let data = Self { id, hello };
Ok(data)
}
async fn decode_async<C: ::tokio::io::AsyncRead + Unpin + Send>(
protocol: &mut ::pilota::thrift::TAsyncBinaryProtocol<C>,
) -> ::std::result::Result<Self, ::pilota::thrift::Error> {
let mut id = None;
let mut hello = None;
protocol.read_struct_begin().await?;
loop {
let field_ident = protocol.read_field_begin().await?;
if field_ident.field_type == ::pilota::thrift::TType::Stop {
break;
}
let field_id = field_ident.id;
match field_id {
Some(1i16) if field_ident.field_type == ::pilota::thrift::TType::Binary => {
id = Some(protocol.read_faststr().await?);
}
Some(2i16) if field_ident.field_type == ::pilota::thrift::TType::Binary => {
hello = Some(protocol.read_faststr().await?);
}
_ => {
protocol.skip(field_ident.field_type).await?;
}
}
protocol.read_field_end().await?;
}
protocol.read_struct_end().await?;
let id = if let Some(id) = id {
id
} else {
return Err(::pilota::thrift::Error::Protocol(
::pilota::thrift::ProtocolError::new(
::pilota::thrift::ProtocolErrorKind::InvalidData,
"field id is required".to_string(),
),
));
};
let hello = if let Some(hello) = hello {
hello
} else {
return Err(::pilota::thrift::Error::Protocol(
::pilota::thrift::ProtocolError::new(
::pilota::thrift::ProtocolErrorKind::InvalidData,
"field hello is required".to_string(),
),
));
};
let data = Self { id, hello };
Ok(data)
}
fn size<T: ::pilota::thrift::TLengthProtocol>(&self, protocol: &mut T) -> usize {
protocol
.write_struct_begin_len(&::pilota::thrift::TStructIdentifier { name: "Test" })
+ {
let value = &self.id;
protocol.write_field_begin_len(&::pilota::thrift::TFieldIdentifier {
name: Some("ID"),
field_type: ::pilota::thrift::TType::Binary,
id: Some(1i16),
}) + protocol.write_faststr_len(value)
+ protocol.write_field_end_len()
}
+ {
let value = &self.hello;
protocol.write_field_begin_len(&::pilota::thrift::TFieldIdentifier {
name: Some("Id"),
field_type: ::pilota::thrift::TType::Binary,
id: Some(2i16),
}) + protocol.write_faststr_len(value)
+ protocol.write_field_end_len()
}
+ protocol.write_field_stop_len()
+ protocol.write_struct_end_len()
}
}
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 AA: i32 = Index::AA as i32;
const B: i32 = Index::B as i32;
match v {
AA => ::std::result::Result::Ok(Index::AA),
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)]
AA,
B,
}
#[::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)
}
}
#[derive(PartialOrd, Hash, Eq, Ord, Debug, :: pilota :: derivative :: Derivative)]
#[derivative(Default)]
#[derive(Clone, PartialEq)]
pub enum TestServiceTestResult {
#[derivative(Default)]
Ok(Test1),
}
#[::async_trait::async_trait]
impl ::pilota::thrift::Message for TestServiceTestResult {
fn encode<T: ::pilota::thrift::TOutputProtocol>(
&self,
protocol: &mut T,
) -> ::std::result::Result<(), ::pilota::thrift::Error> {
protocol.write_struct_begin(&::pilota::thrift::TStructIdentifier {
name: "TestServiceTestResult",
})?;
match self {
TestServiceTestResult::Ok(ref value) => {
protocol.write_field_begin(::pilota::thrift::TType::Struct, 0i16)?;
::pilota::thrift::Message::encode(value, protocol)?;
protocol.write_field_end()?;
}
}
protocol.write_field_stop()?;
protocol.write_struct_end()?;
Ok(())
}
fn decode<T: ::pilota::thrift::TInputProtocol>(
protocol: &mut T,
) -> ::std::result::Result<Self, ::pilota::thrift::Error> {
let mut ret = None;
protocol.read_struct_begin()?;
loop {
let field_ident = protocol.read_field_begin()?;
if field_ident.field_type == ::pilota::thrift::TType::Stop {
break;
}
let field_id = field_ident.id;
match field_id {
Some(0i16) => {
if ret.is_none() {
ret = Some(TestServiceTestResult::Ok(
::pilota::thrift::Message::decode(protocol)?,
));
} else {
return Err(::pilota::thrift::new_protocol_error(
::pilota::thrift::ProtocolErrorKind::InvalidData,
"received multiple fields for union from remote Message",
));
}
}
_ => {
protocol.skip(field_ident.field_type)?;
}
}
}
protocol.read_field_end()?;
protocol.read_struct_end()?;
if let Some(ret) = ret {
Ok(ret)
} else {
Err(::pilota::thrift::new_protocol_error(
::pilota::thrift::ProtocolErrorKind::InvalidData,
"received empty union from remote Message",
))
}
}
async fn decode_async<C: ::tokio::io::AsyncRead + Unpin + Send>(
protocol: &mut ::pilota::thrift::TAsyncBinaryProtocol<C>,
) -> ::std::result::Result<Self, ::pilota::thrift::Error> {
let mut ret = None;
protocol.read_struct_begin().await?;
loop {
let field_ident = protocol.read_field_begin().await?;
if field_ident.field_type == ::pilota::thrift::TType::Stop {
break;
}
let field_id = field_ident.id;
match field_id {
Some(0i16) => {
if ret.is_none() {
ret = Some(TestServiceTestResult::Ok(
::pilota::thrift::Message::decode_async(protocol).await?,
));
} else {
return Err(::pilota::thrift::new_protocol_error(
::pilota::thrift::ProtocolErrorKind::InvalidData,
"received multiple fields for union from remote Message",
));
}
}
_ => {
protocol.skip(field_ident.field_type).await?;
}
}
}
protocol.read_field_end().await?;
protocol.read_struct_end().await?;
if let Some(ret) = ret {
Ok(ret)
} else {
Err(::pilota::thrift::new_protocol_error(
::pilota::thrift::ProtocolErrorKind::InvalidData,
"received empty union from remote Message",
))
}
}
fn size<T: ::pilota::thrift::TLengthProtocol>(&self, protocol: &mut T) -> usize {
protocol.write_struct_begin_len(&::pilota::thrift::TStructIdentifier {
name: "TestServiceTestResult",
}) + match self {
TestServiceTestResult::Ok(ref value) => {
protocol.write_field_begin_len(&::pilota::thrift::TFieldIdentifier {
name: Some("Ok"),
field_type: ::pilota::thrift::TType::Struct,
id: Some(0i16),
}) + ::pilota::thrift::Message::size(value, protocol)
+ protocol.write_field_end_len()
}
} + protocol.write_field_stop_len()
+ protocol.write_struct_end_len()
}
}
#[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)]
pub struct TestServiceTestArgsSend {
pub req: Test2,
}
#[::async_trait::async_trait]
impl ::pilota::thrift::Message for TestServiceTestArgsSend {
fn encode<T: ::pilota::thrift::TOutputProtocol>(
&self,
protocol: &mut T,
) -> ::std::result::Result<(), ::pilota::thrift::Error> {
let struct_ident = ::pilota::thrift::TStructIdentifier {
name: "TestServiceTestArgsSend",
};
protocol.write_struct_begin(&struct_ident)?;
{
let value = &self.req;
protocol.write_field_begin(::pilota::thrift::TType::Struct, 1i16)?;
::pilota::thrift::Message::encode(value, protocol)?;
protocol.write_field_end()?;
}
protocol.write_field_stop()?;
protocol.write_struct_end()?;
Ok(())
}
fn decode<T: ::pilota::thrift::TInputProtocol>(
protocol: &mut T,
) -> ::std::result::Result<Self, ::pilota::thrift::Error> {
let mut req = None;
protocol.read_struct_begin()?;
loop {
let field_ident = protocol.read_field_begin()?;
if field_ident.field_type == ::pilota::thrift::TType::Stop {
break;
}
let field_id = field_ident.id;
match field_id {
Some(1i16) if field_ident.field_type == ::pilota::thrift::TType::Struct => {
req = Some(::pilota::thrift::Message::decode(protocol)?);
}
_ => {
protocol.skip(field_ident.field_type)?;
}
}
protocol.read_field_end()?;
}
protocol.read_struct_end()?;
let req = if let Some(req) = req {
req
} else {
return Err(::pilota::thrift::Error::Protocol(
::pilota::thrift::ProtocolError::new(
::pilota::thrift::ProtocolErrorKind::InvalidData,
"field req is required".to_string(),
),
));
};
let data = Self { req };
Ok(data)
}
async fn decode_async<C: ::tokio::io::AsyncRead + Unpin + Send>(
protocol: &mut ::pilota::thrift::TAsyncBinaryProtocol<C>,
) -> ::std::result::Result<Self, ::pilota::thrift::Error> {
let mut req = None;
protocol.read_struct_begin().await?;
loop {
let field_ident = protocol.read_field_begin().await?;
if field_ident.field_type == ::pilota::thrift::TType::Stop {
break;
}
let field_id = field_ident.id;
match field_id {
Some(1i16) if field_ident.field_type == ::pilota::thrift::TType::Struct => {
req = Some(::pilota::thrift::Message::decode_async(protocol).await?);
}
_ => {
protocol.skip(field_ident.field_type).await?;
}
}
protocol.read_field_end().await?;
}
protocol.read_struct_end().await?;
let req = if let Some(req) = req {
req
} else {
return Err(::pilota::thrift::Error::Protocol(
::pilota::thrift::ProtocolError::new(
::pilota::thrift::ProtocolErrorKind::InvalidData,
"field req is required".to_string(),
),
));
};
let data = Self { req };
Ok(data)
}
fn size<T: ::pilota::thrift::TLengthProtocol>(&self, protocol: &mut T) -> usize {
protocol.write_struct_begin_len(&::pilota::thrift::TStructIdentifier {
name: "TestServiceTestArgsSend",
}) + {
let value = &self.req;
protocol.write_field_begin_len(&::pilota::thrift::TFieldIdentifier {
name: Some("req"),
field_type: ::pilota::thrift::TType::Struct,
id: Some(1i16),
}) + ::pilota::thrift::Message::size(value, protocol)
+ protocol.write_field_end_len()
} + protocol.write_field_stop_len()
+ protocol.write_struct_end_len()
}
}
#[derive(PartialOrd, Hash, Eq, Ord, Debug, Default, Clone, PartialEq)]
pub struct TestServiceTestArgsRecv {
pub req: Test2,
}
#[::async_trait::async_trait]
impl ::pilota::thrift::Message for TestServiceTestArgsRecv {
fn encode<T: ::pilota::thrift::TOutputProtocol>(
&self,
protocol: &mut T,
) -> ::std::result::Result<(), ::pilota::thrift::Error> {
let struct_ident = ::pilota::thrift::TStructIdentifier {
name: "TestServiceTestArgsRecv",
};
protocol.write_struct_begin(&struct_ident)?;
{
let value = &self.req;
protocol.write_field_begin(::pilota::thrift::TType::Struct, 1i16)?;
::pilota::thrift::Message::encode(value, protocol)?;
protocol.write_field_end()?;
}
protocol.write_field_stop()?;
protocol.write_struct_end()?;
Ok(())
}
fn decode<T: ::pilota::thrift::TInputProtocol>(
protocol: &mut T,
) -> ::std::result::Result<Self, ::pilota::thrift::Error> {
let mut req = None;
protocol.read_struct_begin()?;
loop {
let field_ident = protocol.read_field_begin()?;
if field_ident.field_type == ::pilota::thrift::TType::Stop {
break;
}
let field_id = field_ident.id;
match field_id {
Some(1i16) if field_ident.field_type == ::pilota::thrift::TType::Struct => {
req = Some(::pilota::thrift::Message::decode(protocol)?);
}
_ => {
protocol.skip(field_ident.field_type)?;
}
}
protocol.read_field_end()?;
}
protocol.read_struct_end()?;
let req = if let Some(req) = req {
req
} else {
return Err(::pilota::thrift::Error::Protocol(
::pilota::thrift::ProtocolError::new(
::pilota::thrift::ProtocolErrorKind::InvalidData,
"field req is required".to_string(),
),
));
};
let data = Self { req };
Ok(data)
}
async fn decode_async<C: ::tokio::io::AsyncRead + Unpin + Send>(
protocol: &mut ::pilota::thrift::TAsyncBinaryProtocol<C>,
) -> ::std::result::Result<Self, ::pilota::thrift::Error> {
let mut req = None;
protocol.read_struct_begin().await?;
loop {
let field_ident = protocol.read_field_begin().await?;
if field_ident.field_type == ::pilota::thrift::TType::Stop {
break;
}
let field_id = field_ident.id;
match field_id {
Some(1i16) if field_ident.field_type == ::pilota::thrift::TType::Struct => {
req = Some(::pilota::thrift::Message::decode_async(protocol).await?);
}
_ => {
protocol.skip(field_ident.field_type).await?;
}
}
protocol.read_field_end().await?;
}
protocol.read_struct_end().await?;
let req = if let Some(req) = req {
req
} else {
return Err(::pilota::thrift::Error::Protocol(
::pilota::thrift::ProtocolError::new(
::pilota::thrift::ProtocolErrorKind::InvalidData,
"field req is required".to_string(),
),
));
};
let data = Self { req };
Ok(data)
}
fn size<T: ::pilota::thrift::TLengthProtocol>(&self, protocol: &mut T) -> usize {
protocol.write_struct_begin_len(&::pilota::thrift::TStructIdentifier {
name: "TestServiceTestArgsRecv",
}) + {
let value = &self.req;
protocol.write_field_begin_len(&::pilota::thrift::TFieldIdentifier {
name: Some("req"),
field_type: ::pilota::thrift::TType::Struct,
id: Some(1i16),
}) + ::pilota::thrift::Message::size(value, protocol)
+ protocol.write_field_end_len()
} + protocol.write_field_stop_len()
+ protocol.write_struct_end_len()
}
}
#[::async_trait::async_trait]
pub trait TestService {}
}
}