#![allow(non_camel_case_types, non_snake_case, non_upper_case_globals, unused_crate_dependencies)]
pub use self::errors::*;
pub use self::types::*;
pub mod types {
#![allow(clippy::redundant_closure)]
pub type IdType = ::std::primitive::i64;
pub type Timestamp = ::std::primitive::i64;
pub type Year = ::std::primitive::i16;
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct YearMonth {
pub year: ::std::primitive::i16,
pub month: ::std::primitive::i8,
}
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Date {
pub year: ::std::primitive::i16,
pub month: ::std::primitive::i8,
pub day: ::std::primitive::i8,
}
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct DateTime {
pub year: ::std::primitive::i16,
pub month: ::std::primitive::i8,
pub day: ::std::primitive::i8,
pub hour: ::std::primitive::i8,
pub minute: ::std::primitive::i8,
pub second: ::std::primitive::i8,
pub millisec: ::std::primitive::i16,
pub microsec: ::std::primitive::i16,
}
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Vertex {
pub id: common::types::VertexID,
}
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Edge {
pub type_: ::std::vec::Vec<::std::primitive::u8>,
pub ranking: common::types::EdgeRanking,
pub src: ::std::option::Option<common::types::VertexID>,
pub dst: ::std::option::Option<common::types::VertexID>,
}
#[derive(Clone, Debug, PartialEq)]
pub enum PathEntry {
vertex(crate::types::Vertex),
edge(crate::types::Edge),
UnknownField(::std::primitive::i32),
}
#[derive(Clone, Debug, PartialEq)]
pub struct Path {
pub entry_list: ::std::vec::Vec<crate::types::PathEntry>,
}
#[derive(Clone, Debug, PartialEq)]
pub enum ColumnValue {
bool_val(::std::primitive::bool),
integer(::std::primitive::i64),
id(crate::types::IdType),
single_precision(::std::primitive::f32),
double_precision(::std::primitive::f64),
str(::std::vec::Vec<::std::primitive::u8>),
timestamp(crate::types::Timestamp),
year(crate::types::Year),
month(crate::types::YearMonth),
date(crate::types::Date),
datetime(crate::types::DateTime),
path(crate::types::Path),
UnknownField(::std::primitive::i32),
}
#[derive(Clone, Debug, PartialEq)]
pub struct RowValue {
pub columns: ::std::vec::Vec<crate::types::ColumnValue>,
}
#[derive(Clone, Debug, PartialEq)]
pub struct ExecutionResponse {
pub error_code: crate::types::ErrorCode,
pub latency_in_us: ::std::primitive::i32,
pub error_msg: ::std::option::Option<::std::string::String>,
pub column_names: ::std::option::Option<::std::vec::Vec<::std::vec::Vec<::std::primitive::u8>>>,
pub rows: ::std::option::Option<::std::vec::Vec<crate::types::RowValue>>,
pub space_name: ::std::option::Option<::std::string::String>,
pub warning_msg: ::std::option::Option<::std::string::String>,
}
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct AuthResponse {
pub error_code: crate::types::ErrorCode,
pub session_id: ::std::option::Option<::std::primitive::i64>,
pub error_msg: ::std::option::Option<::std::string::String>,
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ErrorCode(pub ::std::primitive::i32);
impl ErrorCode {
pub const SUCCEEDED: Self = ErrorCode(0i32);
pub const E_DISCONNECTED: Self = ErrorCode(-1i32);
pub const E_FAIL_TO_CONNECT: Self = ErrorCode(-2i32);
pub const E_RPC_FAILURE: Self = ErrorCode(-3i32);
pub const E_BAD_USERNAME_PASSWORD: Self = ErrorCode(-4i32);
pub const E_SESSION_INVALID: Self = ErrorCode(-5i32);
pub const E_SESSION_TIMEOUT: Self = ErrorCode(-6i32);
pub const E_SYNTAX_ERROR: Self = ErrorCode(-7i32);
pub const E_EXECUTION_ERROR: Self = ErrorCode(-8i32);
pub const E_STATEMENT_EMTPY: Self = ErrorCode(-9i32);
pub const E_USER_NOT_FOUND: Self = ErrorCode(-10i32);
pub const E_BAD_PERMISSION: Self = ErrorCode(-11i32);
pub fn variants() -> &'static [&'static str] {
&[
"SUCCEEDED",
"E_DISCONNECTED",
"E_FAIL_TO_CONNECT",
"E_RPC_FAILURE",
"E_BAD_USERNAME_PASSWORD",
"E_SESSION_INVALID",
"E_SESSION_TIMEOUT",
"E_SYNTAX_ERROR",
"E_EXECUTION_ERROR",
"E_STATEMENT_EMTPY",
"E_USER_NOT_FOUND",
"E_BAD_PERMISSION",
]
}
}
impl ::std::default::Default for ErrorCode {
fn default() -> Self {
ErrorCode(::fbthrift::__UNKNOWN_ID)
}
}
impl<'a> ::std::convert::From<&'a ErrorCode> for ::std::primitive::i32 {
#[inline]
fn from(x: &'a ErrorCode) -> Self {
x.0
}
}
impl ::std::convert::From<ErrorCode> for ::std::primitive::i32 {
#[inline]
fn from(x: ErrorCode) -> Self {
x.0
}
}
impl ::std::convert::From<::std::primitive::i32> for ErrorCode {
#[inline]
fn from(x: ::std::primitive::i32) -> Self {
Self(x)
}
}
impl ::std::fmt::Display for ErrorCode {
fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
let s: &::std::primitive::str = match *self {
ErrorCode::SUCCEEDED => "SUCCEEDED",
ErrorCode::E_DISCONNECTED => "E_DISCONNECTED",
ErrorCode::E_FAIL_TO_CONNECT => "E_FAIL_TO_CONNECT",
ErrorCode::E_RPC_FAILURE => "E_RPC_FAILURE",
ErrorCode::E_BAD_USERNAME_PASSWORD => "E_BAD_USERNAME_PASSWORD",
ErrorCode::E_SESSION_INVALID => "E_SESSION_INVALID",
ErrorCode::E_SESSION_TIMEOUT => "E_SESSION_TIMEOUT",
ErrorCode::E_SYNTAX_ERROR => "E_SYNTAX_ERROR",
ErrorCode::E_EXECUTION_ERROR => "E_EXECUTION_ERROR",
ErrorCode::E_STATEMENT_EMTPY => "E_STATEMENT_EMTPY",
ErrorCode::E_USER_NOT_FOUND => "E_USER_NOT_FOUND",
ErrorCode::E_BAD_PERMISSION => "E_BAD_PERMISSION",
ErrorCode(x) => return write!(fmt, "{}", x),
};
write!(fmt, "{}", s)
}
}
impl ::std::fmt::Debug for ErrorCode {
fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
write!(fmt, "ErrorCode::{}", self)
}
}
impl ::std::str::FromStr for ErrorCode {
type Err = ::anyhow::Error;
fn from_str(string: &::std::primitive::str) -> ::std::result::Result<Self, Self::Err> {
match string {
"SUCCEEDED" => ::std::result::Result::Ok(ErrorCode::SUCCEEDED),
"E_DISCONNECTED" => ::std::result::Result::Ok(ErrorCode::E_DISCONNECTED),
"E_FAIL_TO_CONNECT" => ::std::result::Result::Ok(ErrorCode::E_FAIL_TO_CONNECT),
"E_RPC_FAILURE" => ::std::result::Result::Ok(ErrorCode::E_RPC_FAILURE),
"E_BAD_USERNAME_PASSWORD" => ::std::result::Result::Ok(ErrorCode::E_BAD_USERNAME_PASSWORD),
"E_SESSION_INVALID" => ::std::result::Result::Ok(ErrorCode::E_SESSION_INVALID),
"E_SESSION_TIMEOUT" => ::std::result::Result::Ok(ErrorCode::E_SESSION_TIMEOUT),
"E_SYNTAX_ERROR" => ::std::result::Result::Ok(ErrorCode::E_SYNTAX_ERROR),
"E_EXECUTION_ERROR" => ::std::result::Result::Ok(ErrorCode::E_EXECUTION_ERROR),
"E_STATEMENT_EMTPY" => ::std::result::Result::Ok(ErrorCode::E_STATEMENT_EMTPY),
"E_USER_NOT_FOUND" => ::std::result::Result::Ok(ErrorCode::E_USER_NOT_FOUND),
"E_BAD_PERMISSION" => ::std::result::Result::Ok(ErrorCode::E_BAD_PERMISSION),
_ => ::anyhow::bail!("Unable to parse {} as ErrorCode", string),
}
}
}
impl ::fbthrift::GetTType for ErrorCode {
const TTYPE: ::fbthrift::TType = ::fbthrift::TType::I32;
}
impl<P> ::fbthrift::Serialize<P> for ErrorCode
where
P: ::fbthrift::ProtocolWriter,
{
#[inline]
fn write(&self, p: &mut P) {
p.write_i32(self.into())
}
}
impl<P> ::fbthrift::Deserialize<P> for ErrorCode
where
P: ::fbthrift::ProtocolReader,
{
#[inline]
fn read(p: &mut P) -> ::anyhow::Result<Self> {
::std::result::Result::Ok(ErrorCode::from(p.read_i32()?))
}
}
impl ::std::default::Default for self::YearMonth {
fn default() -> Self {
Self {
year: ::std::default::Default::default(),
month: ::std::default::Default::default(),
}
}
}
unsafe impl ::std::marker::Send for self::YearMonth {}
unsafe impl ::std::marker::Sync for self::YearMonth {}
impl ::fbthrift::GetTType for self::YearMonth {
const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}
impl<P> ::fbthrift::Serialize<P> for self::YearMonth
where
P: ::fbthrift::ProtocolWriter,
{
fn write(&self, p: &mut P) {
p.write_struct_begin("YearMonth");
p.write_field_begin("year", ::fbthrift::TType::I16, 1);
::fbthrift::Serialize::write(&self.year, p);
p.write_field_end();
p.write_field_begin("month", ::fbthrift::TType::Byte, 2);
::fbthrift::Serialize::write(&self.month, p);
p.write_field_end();
p.write_field_stop();
p.write_struct_end();
}
}
impl<P> ::fbthrift::Deserialize<P> for self::YearMonth
where
P: ::fbthrift::ProtocolReader,
{
fn read(p: &mut P) -> ::anyhow::Result<Self> {
let mut field_year = ::std::option::Option::None;
let mut field_month = ::std::option::Option::None;
let _ = p.read_struct_begin(|_| ())?;
loop {
let (_, fty, fid) = p.read_field_begin(|_| ())?;
match (fty, fid as ::std::primitive::i32) {
(::fbthrift::TType::Stop, _) => break,
(::fbthrift::TType::I16, 1) => field_year = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::Byte, 2) => field_month = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(fty, _) => p.skip(fty)?,
}
p.read_field_end()?;
}
p.read_struct_end()?;
::std::result::Result::Ok(Self {
year: field_year.unwrap_or_default(),
month: field_month.unwrap_or_default(),
})
}
}
impl ::std::default::Default for self::Date {
fn default() -> Self {
Self {
year: ::std::default::Default::default(),
month: ::std::default::Default::default(),
day: ::std::default::Default::default(),
}
}
}
unsafe impl ::std::marker::Send for self::Date {}
unsafe impl ::std::marker::Sync for self::Date {}
impl ::fbthrift::GetTType for self::Date {
const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}
impl<P> ::fbthrift::Serialize<P> for self::Date
where
P: ::fbthrift::ProtocolWriter,
{
fn write(&self, p: &mut P) {
p.write_struct_begin("Date");
p.write_field_begin("year", ::fbthrift::TType::I16, 1);
::fbthrift::Serialize::write(&self.year, p);
p.write_field_end();
p.write_field_begin("month", ::fbthrift::TType::Byte, 2);
::fbthrift::Serialize::write(&self.month, p);
p.write_field_end();
p.write_field_begin("day", ::fbthrift::TType::Byte, 3);
::fbthrift::Serialize::write(&self.day, p);
p.write_field_end();
p.write_field_stop();
p.write_struct_end();
}
}
impl<P> ::fbthrift::Deserialize<P> for self::Date
where
P: ::fbthrift::ProtocolReader,
{
fn read(p: &mut P) -> ::anyhow::Result<Self> {
let mut field_year = ::std::option::Option::None;
let mut field_month = ::std::option::Option::None;
let mut field_day = ::std::option::Option::None;
let _ = p.read_struct_begin(|_| ())?;
loop {
let (_, fty, fid) = p.read_field_begin(|_| ())?;
match (fty, fid as ::std::primitive::i32) {
(::fbthrift::TType::Stop, _) => break,
(::fbthrift::TType::I16, 1) => field_year = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::Byte, 2) => field_month = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::Byte, 3) => field_day = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(fty, _) => p.skip(fty)?,
}
p.read_field_end()?;
}
p.read_struct_end()?;
::std::result::Result::Ok(Self {
year: field_year.unwrap_or_default(),
month: field_month.unwrap_or_default(),
day: field_day.unwrap_or_default(),
})
}
}
impl ::std::default::Default for self::DateTime {
fn default() -> Self {
Self {
year: ::std::default::Default::default(),
month: ::std::default::Default::default(),
day: ::std::default::Default::default(),
hour: ::std::default::Default::default(),
minute: ::std::default::Default::default(),
second: ::std::default::Default::default(),
millisec: ::std::default::Default::default(),
microsec: ::std::default::Default::default(),
}
}
}
unsafe impl ::std::marker::Send for self::DateTime {}
unsafe impl ::std::marker::Sync for self::DateTime {}
impl ::fbthrift::GetTType for self::DateTime {
const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}
impl<P> ::fbthrift::Serialize<P> for self::DateTime
where
P: ::fbthrift::ProtocolWriter,
{
fn write(&self, p: &mut P) {
p.write_struct_begin("DateTime");
p.write_field_begin("year", ::fbthrift::TType::I16, 1);
::fbthrift::Serialize::write(&self.year, p);
p.write_field_end();
p.write_field_begin("month", ::fbthrift::TType::Byte, 2);
::fbthrift::Serialize::write(&self.month, p);
p.write_field_end();
p.write_field_begin("day", ::fbthrift::TType::Byte, 3);
::fbthrift::Serialize::write(&self.day, p);
p.write_field_end();
p.write_field_begin("hour", ::fbthrift::TType::Byte, 4);
::fbthrift::Serialize::write(&self.hour, p);
p.write_field_end();
p.write_field_begin("minute", ::fbthrift::TType::Byte, 5);
::fbthrift::Serialize::write(&self.minute, p);
p.write_field_end();
p.write_field_begin("second", ::fbthrift::TType::Byte, 6);
::fbthrift::Serialize::write(&self.second, p);
p.write_field_end();
p.write_field_begin("millisec", ::fbthrift::TType::I16, 7);
::fbthrift::Serialize::write(&self.millisec, p);
p.write_field_end();
p.write_field_begin("microsec", ::fbthrift::TType::I16, 8);
::fbthrift::Serialize::write(&self.microsec, p);
p.write_field_end();
p.write_field_stop();
p.write_struct_end();
}
}
impl<P> ::fbthrift::Deserialize<P> for self::DateTime
where
P: ::fbthrift::ProtocolReader,
{
fn read(p: &mut P) -> ::anyhow::Result<Self> {
let mut field_year = ::std::option::Option::None;
let mut field_month = ::std::option::Option::None;
let mut field_day = ::std::option::Option::None;
let mut field_hour = ::std::option::Option::None;
let mut field_minute = ::std::option::Option::None;
let mut field_second = ::std::option::Option::None;
let mut field_millisec = ::std::option::Option::None;
let mut field_microsec = ::std::option::Option::None;
let _ = p.read_struct_begin(|_| ())?;
loop {
let (_, fty, fid) = p.read_field_begin(|_| ())?;
match (fty, fid as ::std::primitive::i32) {
(::fbthrift::TType::Stop, _) => break,
(::fbthrift::TType::I16, 1) => field_year = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::Byte, 2) => field_month = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::Byte, 3) => field_day = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::Byte, 4) => field_hour = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::Byte, 5) => field_minute = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::Byte, 6) => field_second = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::I16, 7) => field_millisec = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::I16, 8) => field_microsec = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(fty, _) => p.skip(fty)?,
}
p.read_field_end()?;
}
p.read_struct_end()?;
::std::result::Result::Ok(Self {
year: field_year.unwrap_or_default(),
month: field_month.unwrap_or_default(),
day: field_day.unwrap_or_default(),
hour: field_hour.unwrap_or_default(),
minute: field_minute.unwrap_or_default(),
second: field_second.unwrap_or_default(),
millisec: field_millisec.unwrap_or_default(),
microsec: field_microsec.unwrap_or_default(),
})
}
}
impl ::std::default::Default for self::Vertex {
fn default() -> Self {
Self {
id: ::std::default::Default::default(),
}
}
}
unsafe impl ::std::marker::Send for self::Vertex {}
unsafe impl ::std::marker::Sync for self::Vertex {}
impl ::fbthrift::GetTType for self::Vertex {
const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}
impl<P> ::fbthrift::Serialize<P> for self::Vertex
where
P: ::fbthrift::ProtocolWriter,
{
fn write(&self, p: &mut P) {
p.write_struct_begin("Vertex");
p.write_field_begin("id", ::fbthrift::TType::I64, 1);
::fbthrift::Serialize::write(&self.id, p);
p.write_field_end();
p.write_field_stop();
p.write_struct_end();
}
}
impl<P> ::fbthrift::Deserialize<P> for self::Vertex
where
P: ::fbthrift::ProtocolReader,
{
fn read(p: &mut P) -> ::anyhow::Result<Self> {
let mut field_id = ::std::option::Option::None;
let _ = p.read_struct_begin(|_| ())?;
loop {
let (_, fty, fid) = p.read_field_begin(|_| ())?;
match (fty, fid as ::std::primitive::i32) {
(::fbthrift::TType::Stop, _) => break,
(::fbthrift::TType::I64, 1) => field_id = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(fty, _) => p.skip(fty)?,
}
p.read_field_end()?;
}
p.read_struct_end()?;
::std::result::Result::Ok(Self {
id: field_id.unwrap_or_default(),
})
}
}
impl ::std::default::Default for self::Edge {
fn default() -> Self {
Self {
type_: ::std::default::Default::default(),
ranking: ::std::default::Default::default(),
src: ::std::option::Option::None,
dst: ::std::option::Option::None,
}
}
}
unsafe impl ::std::marker::Send for self::Edge {}
unsafe impl ::std::marker::Sync for self::Edge {}
impl ::fbthrift::GetTType for self::Edge {
const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}
impl<P> ::fbthrift::Serialize<P> for self::Edge
where
P: ::fbthrift::ProtocolWriter,
{
fn write(&self, p: &mut P) {
p.write_struct_begin("Edge");
p.write_field_begin("type", ::fbthrift::TType::String, 1);
::fbthrift::Serialize::write(&self.type_, p);
p.write_field_end();
p.write_field_begin("ranking", ::fbthrift::TType::I64, 2);
::fbthrift::Serialize::write(&self.ranking, p);
p.write_field_end();
if let ::std::option::Option::Some(some) = &self.src {
p.write_field_begin("src", ::fbthrift::TType::I64, 3);
::fbthrift::Serialize::write(some, p);
p.write_field_end();
}
if let ::std::option::Option::Some(some) = &self.dst {
p.write_field_begin("dst", ::fbthrift::TType::I64, 4);
::fbthrift::Serialize::write(some, p);
p.write_field_end();
}
p.write_field_stop();
p.write_struct_end();
}
}
impl<P> ::fbthrift::Deserialize<P> for self::Edge
where
P: ::fbthrift::ProtocolReader,
{
fn read(p: &mut P) -> ::anyhow::Result<Self> {
let mut field_type = ::std::option::Option::None;
let mut field_ranking = ::std::option::Option::None;
let mut field_src = ::std::option::Option::None;
let mut field_dst = ::std::option::Option::None;
let _ = p.read_struct_begin(|_| ())?;
loop {
let (_, fty, fid) = p.read_field_begin(|_| ())?;
match (fty, fid as ::std::primitive::i32) {
(::fbthrift::TType::Stop, _) => break,
(::fbthrift::TType::String, 1) => field_type = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::I64, 2) => field_ranking = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::I64, 3) => field_src = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::I64, 4) => field_dst = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(fty, _) => p.skip(fty)?,
}
p.read_field_end()?;
}
p.read_struct_end()?;
::std::result::Result::Ok(Self {
type_: field_type.unwrap_or_default(),
ranking: field_ranking.unwrap_or_default(),
src: field_src,
dst: field_dst,
})
}
}
impl ::std::default::Default for PathEntry {
fn default() -> Self {
Self::UnknownField(-1)
}
}
impl ::fbthrift::GetTType for PathEntry {
const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}
impl<P> ::fbthrift::Serialize<P> for PathEntry
where
P: ::fbthrift::ProtocolWriter,
{
fn write(&self, p: &mut P) {
p.write_struct_begin("PathEntry");
match self {
PathEntry::vertex(inner) => {
p.write_field_begin("vertex", ::fbthrift::TType::Struct, 1);
::fbthrift::Serialize::write(inner, p);
p.write_field_end();
}
PathEntry::edge(inner) => {
p.write_field_begin("edge", ::fbthrift::TType::Struct, 2);
::fbthrift::Serialize::write(inner, p);
p.write_field_end();
}
PathEntry::UnknownField(x) => {
p.write_field_begin("UnknownField", ::fbthrift::TType::I32, *x as ::std::primitive::i16);
x.write(p);
p.write_field_end();
}
}
p.write_field_stop();
p.write_struct_end();
}
}
impl<P> ::fbthrift::Deserialize<P> for PathEntry
where
P: ::fbthrift::ProtocolReader,
{
fn read(p: &mut P) -> ::anyhow::Result<Self> {
let _ = p.read_struct_begin(|_| ())?;
let mut once = false;
let mut alt = ::std::option::Option::None;
loop {
let (_, fty, fid) = p.read_field_begin(|_| ())?;
match (fty, fid as ::std::primitive::i32, once) {
(::fbthrift::TType::Stop, _, _) => break,
(::fbthrift::TType::Struct, 1, false) => {
once = true;
alt = ::std::option::Option::Some(PathEntry::vertex(::fbthrift::Deserialize::read(p)?));
}
(::fbthrift::TType::Struct, 2, false) => {
once = true;
alt = ::std::option::Option::Some(PathEntry::edge(::fbthrift::Deserialize::read(p)?));
}
(fty, _, false) => p.skip(fty)?,
(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 {}",
"PathEntry",
badty,
badid,
),
))),
}
p.read_field_end()?;
}
p.read_struct_end()?;
::std::result::Result::Ok(alt.unwrap_or_default())
}
}
impl ::std::default::Default for self::Path {
fn default() -> Self {
Self {
entry_list: ::std::default::Default::default(),
}
}
}
unsafe impl ::std::marker::Send for self::Path {}
unsafe impl ::std::marker::Sync for self::Path {}
impl ::fbthrift::GetTType for self::Path {
const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}
impl<P> ::fbthrift::Serialize<P> for self::Path
where
P: ::fbthrift::ProtocolWriter,
{
fn write(&self, p: &mut P) {
p.write_struct_begin("Path");
p.write_field_begin("entry_list", ::fbthrift::TType::List, 1);
::fbthrift::Serialize::write(&self.entry_list, p);
p.write_field_end();
p.write_field_stop();
p.write_struct_end();
}
}
impl<P> ::fbthrift::Deserialize<P> for self::Path
where
P: ::fbthrift::ProtocolReader,
{
fn read(p: &mut P) -> ::anyhow::Result<Self> {
let mut field_entry_list = ::std::option::Option::None;
let _ = p.read_struct_begin(|_| ())?;
loop {
let (_, fty, fid) = p.read_field_begin(|_| ())?;
match (fty, fid as ::std::primitive::i32) {
(::fbthrift::TType::Stop, _) => break,
(::fbthrift::TType::List, 1) => field_entry_list = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(fty, _) => p.skip(fty)?,
}
p.read_field_end()?;
}
p.read_struct_end()?;
::std::result::Result::Ok(Self {
entry_list: field_entry_list.unwrap_or_default(),
})
}
}
impl ::std::default::Default for ColumnValue {
fn default() -> Self {
Self::UnknownField(-1)
}
}
impl ::fbthrift::GetTType for ColumnValue {
const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}
impl<P> ::fbthrift::Serialize<P> for ColumnValue
where
P: ::fbthrift::ProtocolWriter,
{
fn write(&self, p: &mut P) {
p.write_struct_begin("ColumnValue");
match self {
ColumnValue::bool_val(inner) => {
p.write_field_begin("bool_val", ::fbthrift::TType::Bool, 1);
::fbthrift::Serialize::write(inner, p);
p.write_field_end();
}
ColumnValue::integer(inner) => {
p.write_field_begin("integer", ::fbthrift::TType::I64, 2);
::fbthrift::Serialize::write(inner, p);
p.write_field_end();
}
ColumnValue::id(inner) => {
p.write_field_begin("id", ::fbthrift::TType::I64, 3);
::fbthrift::Serialize::write(inner, p);
p.write_field_end();
}
ColumnValue::single_precision(inner) => {
p.write_field_begin("single_precision", ::fbthrift::TType::Float, 4);
::fbthrift::Serialize::write(inner, p);
p.write_field_end();
}
ColumnValue::double_precision(inner) => {
p.write_field_begin("double_precision", ::fbthrift::TType::Double, 5);
::fbthrift::Serialize::write(inner, p);
p.write_field_end();
}
ColumnValue::str(inner) => {
p.write_field_begin("str", ::fbthrift::TType::String, 6);
::fbthrift::Serialize::write(inner, p);
p.write_field_end();
}
ColumnValue::timestamp(inner) => {
p.write_field_begin("timestamp", ::fbthrift::TType::I64, 7);
::fbthrift::Serialize::write(inner, p);
p.write_field_end();
}
ColumnValue::year(inner) => {
p.write_field_begin("year", ::fbthrift::TType::I16, 8);
::fbthrift::Serialize::write(inner, p);
p.write_field_end();
}
ColumnValue::month(inner) => {
p.write_field_begin("month", ::fbthrift::TType::Struct, 9);
::fbthrift::Serialize::write(inner, p);
p.write_field_end();
}
ColumnValue::date(inner) => {
p.write_field_begin("date", ::fbthrift::TType::Struct, 10);
::fbthrift::Serialize::write(inner, p);
p.write_field_end();
}
ColumnValue::datetime(inner) => {
p.write_field_begin("datetime", ::fbthrift::TType::Struct, 11);
::fbthrift::Serialize::write(inner, p);
p.write_field_end();
}
ColumnValue::path(inner) => {
p.write_field_begin("path", ::fbthrift::TType::Struct, 41);
::fbthrift::Serialize::write(inner, p);
p.write_field_end();
}
ColumnValue::UnknownField(x) => {
p.write_field_begin("UnknownField", ::fbthrift::TType::I32, *x as ::std::primitive::i16);
x.write(p);
p.write_field_end();
}
}
p.write_field_stop();
p.write_struct_end();
}
}
impl<P> ::fbthrift::Deserialize<P> for ColumnValue
where
P: ::fbthrift::ProtocolReader,
{
fn read(p: &mut P) -> ::anyhow::Result<Self> {
let _ = p.read_struct_begin(|_| ())?;
let mut once = false;
let mut alt = ::std::option::Option::None;
loop {
let (_, fty, fid) = p.read_field_begin(|_| ())?;
match (fty, fid as ::std::primitive::i32, once) {
(::fbthrift::TType::Stop, _, _) => break,
(::fbthrift::TType::Bool, 1, false) => {
once = true;
alt = ::std::option::Option::Some(ColumnValue::bool_val(::fbthrift::Deserialize::read(p)?));
}
(::fbthrift::TType::I64, 2, false) => {
once = true;
alt = ::std::option::Option::Some(ColumnValue::integer(::fbthrift::Deserialize::read(p)?));
}
(::fbthrift::TType::I64, 3, false) => {
once = true;
alt = ::std::option::Option::Some(ColumnValue::id(::fbthrift::Deserialize::read(p)?));
}
(::fbthrift::TType::Float, 4, false) => {
once = true;
alt = ::std::option::Option::Some(ColumnValue::single_precision(::fbthrift::Deserialize::read(p)?));
}
(::fbthrift::TType::Double, 5, false) => {
once = true;
alt = ::std::option::Option::Some(ColumnValue::double_precision(::fbthrift::Deserialize::read(p)?));
}
(::fbthrift::TType::String, 6, false) => {
once = true;
alt = ::std::option::Option::Some(ColumnValue::str(::fbthrift::Deserialize::read(p)?));
}
(::fbthrift::TType::I64, 7, false) => {
once = true;
alt = ::std::option::Option::Some(ColumnValue::timestamp(::fbthrift::Deserialize::read(p)?));
}
(::fbthrift::TType::I16, 8, false) => {
once = true;
alt = ::std::option::Option::Some(ColumnValue::year(::fbthrift::Deserialize::read(p)?));
}
(::fbthrift::TType::Struct, 9, false) => {
once = true;
alt = ::std::option::Option::Some(ColumnValue::month(::fbthrift::Deserialize::read(p)?));
}
(::fbthrift::TType::Struct, 10, false) => {
once = true;
alt = ::std::option::Option::Some(ColumnValue::date(::fbthrift::Deserialize::read(p)?));
}
(::fbthrift::TType::Struct, 11, false) => {
once = true;
alt = ::std::option::Option::Some(ColumnValue::datetime(::fbthrift::Deserialize::read(p)?));
}
(::fbthrift::TType::Struct, 41, false) => {
once = true;
alt = ::std::option::Option::Some(ColumnValue::path(::fbthrift::Deserialize::read(p)?));
}
(fty, _, false) => p.skip(fty)?,
(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 {}",
"ColumnValue",
badty,
badid,
),
))),
}
p.read_field_end()?;
}
p.read_struct_end()?;
::std::result::Result::Ok(alt.unwrap_or_default())
}
}
impl ::std::default::Default for self::RowValue {
fn default() -> Self {
Self {
columns: ::std::default::Default::default(),
}
}
}
unsafe impl ::std::marker::Send for self::RowValue {}
unsafe impl ::std::marker::Sync for self::RowValue {}
impl ::fbthrift::GetTType for self::RowValue {
const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}
impl<P> ::fbthrift::Serialize<P> for self::RowValue
where
P: ::fbthrift::ProtocolWriter,
{
fn write(&self, p: &mut P) {
p.write_struct_begin("RowValue");
p.write_field_begin("columns", ::fbthrift::TType::List, 1);
::fbthrift::Serialize::write(&self.columns, p);
p.write_field_end();
p.write_field_stop();
p.write_struct_end();
}
}
impl<P> ::fbthrift::Deserialize<P> for self::RowValue
where
P: ::fbthrift::ProtocolReader,
{
fn read(p: &mut P) -> ::anyhow::Result<Self> {
let mut field_columns = ::std::option::Option::None;
let _ = p.read_struct_begin(|_| ())?;
loop {
let (_, fty, fid) = p.read_field_begin(|_| ())?;
match (fty, fid as ::std::primitive::i32) {
(::fbthrift::TType::Stop, _) => break,
(::fbthrift::TType::List, 1) => field_columns = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(fty, _) => p.skip(fty)?,
}
p.read_field_end()?;
}
p.read_struct_end()?;
::std::result::Result::Ok(Self {
columns: field_columns.unwrap_or_default(),
})
}
}
impl ::std::default::Default for self::ExecutionResponse {
fn default() -> Self {
Self {
error_code: ::std::default::Default::default(),
latency_in_us: ::std::default::Default::default(),
error_msg: ::std::option::Option::None,
column_names: ::std::option::Option::None,
rows: ::std::option::Option::None,
space_name: ::std::option::Option::None,
warning_msg: ::std::option::Option::None,
}
}
}
unsafe impl ::std::marker::Send for self::ExecutionResponse {}
unsafe impl ::std::marker::Sync for self::ExecutionResponse {}
impl ::fbthrift::GetTType for self::ExecutionResponse {
const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}
impl<P> ::fbthrift::Serialize<P> for self::ExecutionResponse
where
P: ::fbthrift::ProtocolWriter,
{
fn write(&self, p: &mut P) {
p.write_struct_begin("ExecutionResponse");
p.write_field_begin("error_code", ::fbthrift::TType::I32, 1);
::fbthrift::Serialize::write(&self.error_code, p);
p.write_field_end();
p.write_field_begin("latency_in_us", ::fbthrift::TType::I32, 2);
::fbthrift::Serialize::write(&self.latency_in_us, p);
p.write_field_end();
if let ::std::option::Option::Some(some) = &self.error_msg {
p.write_field_begin("error_msg", ::fbthrift::TType::String, 3);
::fbthrift::Serialize::write(some, p);
p.write_field_end();
}
if let ::std::option::Option::Some(some) = &self.column_names {
p.write_field_begin("column_names", ::fbthrift::TType::List, 4);
::fbthrift::Serialize::write(some, p);
p.write_field_end();
}
if let ::std::option::Option::Some(some) = &self.rows {
p.write_field_begin("rows", ::fbthrift::TType::List, 5);
::fbthrift::Serialize::write(some, p);
p.write_field_end();
}
if let ::std::option::Option::Some(some) = &self.space_name {
p.write_field_begin("space_name", ::fbthrift::TType::String, 6);
::fbthrift::Serialize::write(some, p);
p.write_field_end();
}
if let ::std::option::Option::Some(some) = &self.warning_msg {
p.write_field_begin("warning_msg", ::fbthrift::TType::String, 7);
::fbthrift::Serialize::write(some, p);
p.write_field_end();
}
p.write_field_stop();
p.write_struct_end();
}
}
impl<P> ::fbthrift::Deserialize<P> for self::ExecutionResponse
where
P: ::fbthrift::ProtocolReader,
{
fn read(p: &mut P) -> ::anyhow::Result<Self> {
let mut field_error_code = ::std::option::Option::None;
let mut field_latency_in_us = ::std::option::Option::None;
let mut field_error_msg = ::std::option::Option::None;
let mut field_column_names = ::std::option::Option::None;
let mut field_rows = ::std::option::Option::None;
let mut field_space_name = ::std::option::Option::None;
let mut field_warning_msg = ::std::option::Option::None;
let _ = p.read_struct_begin(|_| ())?;
loop {
let (_, fty, fid) = p.read_field_begin(|_| ())?;
match (fty, fid as ::std::primitive::i32) {
(::fbthrift::TType::Stop, _) => break,
(::fbthrift::TType::I32, 1) => field_error_code = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::I32, 2) => field_latency_in_us = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::String, 3) => field_error_msg = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::List, 4) => field_column_names = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::List, 5) => field_rows = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::String, 6) => field_space_name = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::String, 7) => field_warning_msg = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(fty, _) => p.skip(fty)?,
}
p.read_field_end()?;
}
p.read_struct_end()?;
::std::result::Result::Ok(Self {
error_code: field_error_code.unwrap_or_default(),
latency_in_us: field_latency_in_us.unwrap_or_default(),
error_msg: field_error_msg,
column_names: field_column_names,
rows: field_rows,
space_name: field_space_name,
warning_msg: field_warning_msg,
})
}
}
impl ::std::default::Default for self::AuthResponse {
fn default() -> Self {
Self {
error_code: ::std::default::Default::default(),
session_id: ::std::option::Option::None,
error_msg: ::std::option::Option::None,
}
}
}
unsafe impl ::std::marker::Send for self::AuthResponse {}
unsafe impl ::std::marker::Sync for self::AuthResponse {}
impl ::fbthrift::GetTType for self::AuthResponse {
const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}
impl<P> ::fbthrift::Serialize<P> for self::AuthResponse
where
P: ::fbthrift::ProtocolWriter,
{
fn write(&self, p: &mut P) {
p.write_struct_begin("AuthResponse");
p.write_field_begin("error_code", ::fbthrift::TType::I32, 1);
::fbthrift::Serialize::write(&self.error_code, p);
p.write_field_end();
if let ::std::option::Option::Some(some) = &self.session_id {
p.write_field_begin("session_id", ::fbthrift::TType::I64, 2);
::fbthrift::Serialize::write(some, p);
p.write_field_end();
}
if let ::std::option::Option::Some(some) = &self.error_msg {
p.write_field_begin("error_msg", ::fbthrift::TType::String, 3);
::fbthrift::Serialize::write(some, p);
p.write_field_end();
}
p.write_field_stop();
p.write_struct_end();
}
}
impl<P> ::fbthrift::Deserialize<P> for self::AuthResponse
where
P: ::fbthrift::ProtocolReader,
{
fn read(p: &mut P) -> ::anyhow::Result<Self> {
let mut field_error_code = ::std::option::Option::None;
let mut field_session_id = ::std::option::Option::None;
let mut field_error_msg = ::std::option::Option::None;
let _ = p.read_struct_begin(|_| ())?;
loop {
let (_, fty, fid) = p.read_field_begin(|_| ())?;
match (fty, fid as ::std::primitive::i32) {
(::fbthrift::TType::Stop, _) => break,
(::fbthrift::TType::I32, 1) => field_error_code = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::I64, 2) => field_session_id = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::String, 3) => field_error_msg = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(fty, _) => p.skip(fty)?,
}
p.read_field_end()?;
}
p.read_struct_end()?;
::std::result::Result::Ok(Self {
error_code: field_error_code.unwrap_or_default(),
session_id: field_session_id,
error_msg: field_error_msg,
})
}
}
}
pub mod dependencies {
pub use common as common;
}
pub mod services {
pub mod graph_service {
#[derive(Clone, Debug)]
pub enum AuthenticateExn {
Success(crate::types::AuthResponse),
ApplicationException(::fbthrift::ApplicationException),
}
impl ::std::convert::From<::fbthrift::ApplicationException> for AuthenticateExn {
fn from(exn: ::fbthrift::ApplicationException) -> Self {
AuthenticateExn::ApplicationException(exn)
}
}
impl ::fbthrift::GetTType for AuthenticateExn {
const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}
impl<P> ::fbthrift::Serialize<P> for AuthenticateExn
where
P: ::fbthrift::ProtocolWriter,
{
fn write(&self, p: &mut P) {
p.write_struct_begin("Authenticate");
match self {
AuthenticateExn::Success(inner) => {
p.write_field_begin(
"Success",
::fbthrift::TType::Struct,
0i16,
);
inner.write(p);
p.write_field_end();
}
AuthenticateExn::ApplicationException(_) => panic!(
"Bad union Alt field {} id {}",
"ApplicationException",
-2147483648i32,
),
}
p.write_field_stop();
p.write_struct_end();
}
}
impl<P> ::fbthrift::Deserialize<P> for AuthenticateExn
where
P: ::fbthrift::ProtocolReader,
{
fn read(p: &mut P) -> ::anyhow::Result<Self> {
let _ = p.read_struct_begin(|_| ())?;
let mut once = false;
let mut alt = ::std::option::Option::None;
loop {
let (_, fty, fid) = p.read_field_begin(|_| ())?;
match ((fty, fid as ::std::primitive::i32), once) {
((::fbthrift::TType::Stop, _), _) => {
p.read_field_end()?;
break;
}
((::fbthrift::TType::Struct, 0i32), false) => {
once = true;
alt = ::std::option::Option::Some(AuthenticateExn::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 {}",
"AuthenticateExn",
badty,
badid,
),
)
)),
}
p.read_field_end()?;
}
p.read_struct_end()?;
alt.ok_or_else(||
::fbthrift::ApplicationException::new(
::fbthrift::ApplicationExceptionErrorCode::MissingResult,
format!("Empty union {}", "AuthenticateExn"),
)
.into(),
)
}
}
#[derive(Clone, Debug)]
pub enum SignoutExn {
Success(()),
ApplicationException(::fbthrift::ApplicationException),
}
impl ::std::convert::From<::fbthrift::ApplicationException> for SignoutExn {
fn from(exn: ::fbthrift::ApplicationException) -> Self {
SignoutExn::ApplicationException(exn)
}
}
impl ::fbthrift::GetTType for SignoutExn {
const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}
impl<P> ::fbthrift::Serialize<P> for SignoutExn
where
P: ::fbthrift::ProtocolWriter,
{
fn write(&self, p: &mut P) {
p.write_struct_begin("Signout");
match self {
SignoutExn::Success(inner) => {
p.write_field_begin(
"Success",
::fbthrift::TType::Void,
0i16,
);
inner.write(p);
p.write_field_end();
}
SignoutExn::ApplicationException(_) => panic!(
"Bad union Alt field {} id {}",
"ApplicationException",
-2147483648i32,
),
}
p.write_field_stop();
p.write_struct_end();
}
}
impl<P> ::fbthrift::Deserialize<P> for SignoutExn
where
P: ::fbthrift::ProtocolReader,
{
fn read(p: &mut P) -> ::anyhow::Result<Self> {
let _ = p.read_struct_begin(|_| ())?;
let mut once = false;
let mut alt = SignoutExn::Success(());
loop {
let (_, fty, fid) = p.read_field_begin(|_| ())?;
match ((fty, fid as ::std::primitive::i32), once) {
((::fbthrift::TType::Stop, _), _) => {
p.read_field_end()?;
break;
}
((::fbthrift::TType::Void, 0i32), false) => {
once = true;
alt = SignoutExn::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 {}",
"SignoutExn",
badty,
badid,
),
)
)),
}
p.read_field_end()?;
}
p.read_struct_end()?;
::std::result::Result::Ok(alt)
}
}
#[derive(Clone, Debug)]
pub enum ExecuteExn {
Success(crate::types::ExecutionResponse),
ApplicationException(::fbthrift::ApplicationException),
}
impl ::std::convert::From<::fbthrift::ApplicationException> for ExecuteExn {
fn from(exn: ::fbthrift::ApplicationException) -> Self {
ExecuteExn::ApplicationException(exn)
}
}
impl ::fbthrift::GetTType for ExecuteExn {
const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}
impl<P> ::fbthrift::Serialize<P> for ExecuteExn
where
P: ::fbthrift::ProtocolWriter,
{
fn write(&self, p: &mut P) {
p.write_struct_begin("Execute");
match self {
ExecuteExn::Success(inner) => {
p.write_field_begin(
"Success",
::fbthrift::TType::Struct,
0i16,
);
inner.write(p);
p.write_field_end();
}
ExecuteExn::ApplicationException(_) => panic!(
"Bad union Alt field {} id {}",
"ApplicationException",
-2147483648i32,
),
}
p.write_field_stop();
p.write_struct_end();
}
}
impl<P> ::fbthrift::Deserialize<P> for ExecuteExn
where
P: ::fbthrift::ProtocolReader,
{
fn read(p: &mut P) -> ::anyhow::Result<Self> {
let _ = p.read_struct_begin(|_| ())?;
let mut once = false;
let mut alt = ::std::option::Option::None;
loop {
let (_, fty, fid) = p.read_field_begin(|_| ())?;
match ((fty, fid as ::std::primitive::i32), once) {
((::fbthrift::TType::Stop, _), _) => {
p.read_field_end()?;
break;
}
((::fbthrift::TType::Struct, 0i32), false) => {
once = true;
alt = ::std::option::Option::Some(ExecuteExn::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 {}",
"ExecuteExn",
badty,
badid,
),
)
)),
}
p.read_field_end()?;
}
p.read_struct_end()?;
alt.ok_or_else(||
::fbthrift::ApplicationException::new(
::fbthrift::ApplicationExceptionErrorCode::MissingResult,
format!("Empty union {}", "ExecuteExn"),
)
.into(),
)
}
}
}
}
pub mod client {
pub struct GraphServiceImpl<P, T> {
transport: T,
_phantom: ::std::marker::PhantomData<fn() -> P>,
}
impl<P, T> GraphServiceImpl<P, T> {
pub fn new(
transport: T,
) -> Self {
Self {
transport,
_phantom: ::std::marker::PhantomData,
}
}
pub fn transport(&self) -> &T {
&self.transport
}
}
pub trait GraphService: ::std::marker::Send {
fn authenticate(
&self,
arg_username: &::std::primitive::str,
arg_password: &::std::primitive::str,
) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<crate::types::AuthResponse, crate::errors::graph_service::AuthenticateError>> + ::std::marker::Send + 'static>>;
fn signout(
&self,
arg_sessionId: ::std::primitive::i64,
) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(), crate::errors::graph_service::SignoutError>> + ::std::marker::Send + 'static>>;
fn execute(
&self,
arg_sessionId: ::std::primitive::i64,
arg_stmt: &::std::primitive::str,
) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<crate::types::ExecutionResponse, crate::errors::graph_service::ExecuteError>> + ::std::marker::Send + 'static>>;
}
impl<P, T> GraphService for GraphServiceImpl<P, T>
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Frame: ::fbthrift::Framing<DecBuf = ::fbthrift::FramingDecoded<T>>,
::fbthrift::ProtocolEncoded<P>: ::fbthrift::BufMutExt<Final = ::fbthrift::FramingEncodedFinal<T>>,
{ fn authenticate(
&self,
arg_username: &::std::primitive::str,
arg_password: &::std::primitive::str,
) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<crate::types::AuthResponse, crate::errors::graph_service::AuthenticateError>> + ::std::marker::Send + 'static>> {
use ::fbthrift::{ProtocolReader as _, ProtocolWriter as _};
use ::futures::future::{FutureExt as _, TryFutureExt as _};
let request = ::fbthrift::serialize!(P, |p| ::fbthrift::protocol::write_message(
p,
"authenticate",
::fbthrift::MessageType::Call,
0,
|p| {
p.write_struct_begin("args");
p.write_field_begin("arg_username", ::fbthrift::TType::String, 1i16);
::fbthrift::Serialize::write(&arg_username, p);
p.write_field_end();
p.write_field_begin("arg_password", ::fbthrift::TType::String, 2i16);
::fbthrift::Serialize::write(&arg_password, p);
p.write_field_end();
p.write_field_stop();
p.write_struct_end();
},
));
self.transport()
.call(request)
.map_err(::std::convert::From::from)
.and_then(|reply| ::futures::future::ready({
let de = P::deserializer(reply);
move |mut p: P::Deserializer| -> ::std::result::Result<crate::types::AuthResponse, crate::errors::graph_service::AuthenticateError> {
let p = &mut p;
let (_, message_type, _) = p.read_message_begin(|_| ())?;
let result = match message_type {
::fbthrift::MessageType::Reply => {
let exn: crate::services::graph_service::AuthenticateExn = ::fbthrift::Deserialize::read(p)?;
match exn {
crate::services::graph_service::AuthenticateExn::Success(x) => ::std::result::Result::Ok(x),
crate::services::graph_service::AuthenticateExn::ApplicationException(ae) => {
::std::result::Result::Err(crate::errors::graph_service::AuthenticateError::ApplicationException(ae))
}
}
}
::fbthrift::MessageType::Exception => {
let ae: ::fbthrift::ApplicationException = ::fbthrift::Deserialize::read(p)?;
::std::result::Result::Err(crate::errors::graph_service::AuthenticateError::ApplicationException(ae))
}
::fbthrift::MessageType::Call | ::fbthrift::MessageType::Oneway | ::fbthrift::MessageType::InvalidMessageType => {
let err = ::anyhow::anyhow!("Unexpected message type {:?}", message_type);
::std::result::Result::Err(crate::errors::graph_service::AuthenticateError::ThriftError(err))
}
};
p.read_message_end()?;
result
}(de)
}))
.boxed()
}
fn signout(
&self,
arg_sessionId: ::std::primitive::i64,
) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(), crate::errors::graph_service::SignoutError>> + ::std::marker::Send + 'static>> {
use ::fbthrift::{ProtocolReader as _, ProtocolWriter as _};
use ::futures::future::{FutureExt as _, TryFutureExt as _};
let request = ::fbthrift::serialize!(P, |p| ::fbthrift::protocol::write_message(
p,
"signout",
::fbthrift::MessageType::Call,
0,
|p| {
p.write_struct_begin("args");
p.write_field_begin("arg_sessionId", ::fbthrift::TType::I64, 1i16);
::fbthrift::Serialize::write(&arg_sessionId, p);
p.write_field_end();
p.write_field_stop();
p.write_struct_end();
},
));
self.transport()
.call(request)
.map_err(::std::convert::From::from)
.and_then(|reply| ::futures::future::ready({
let de = P::deserializer(reply);
move |mut p: P::Deserializer| -> ::std::result::Result<(), crate::errors::graph_service::SignoutError> {
let p = &mut p;
let (_, message_type, _) = p.read_message_begin(|_| ())?;
let result = match message_type {
::fbthrift::MessageType::Reply => {
let exn: crate::services::graph_service::SignoutExn = ::fbthrift::Deserialize::read(p)?;
match exn {
crate::services::graph_service::SignoutExn::Success(x) => ::std::result::Result::Ok(x),
crate::services::graph_service::SignoutExn::ApplicationException(ae) => {
::std::result::Result::Err(crate::errors::graph_service::SignoutError::ApplicationException(ae))
}
}
}
::fbthrift::MessageType::Exception => {
let ae: ::fbthrift::ApplicationException = ::fbthrift::Deserialize::read(p)?;
::std::result::Result::Err(crate::errors::graph_service::SignoutError::ApplicationException(ae))
}
::fbthrift::MessageType::Call | ::fbthrift::MessageType::Oneway | ::fbthrift::MessageType::InvalidMessageType => {
let err = ::anyhow::anyhow!("Unexpected message type {:?}", message_type);
::std::result::Result::Err(crate::errors::graph_service::SignoutError::ThriftError(err))
}
};
p.read_message_end()?;
result
}(de)
}))
.boxed()
}
fn execute(
&self,
arg_sessionId: ::std::primitive::i64,
arg_stmt: &::std::primitive::str,
) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<crate::types::ExecutionResponse, crate::errors::graph_service::ExecuteError>> + ::std::marker::Send + 'static>> {
use ::fbthrift::{ProtocolReader as _, ProtocolWriter as _};
use ::futures::future::{FutureExt as _, TryFutureExt as _};
let request = ::fbthrift::serialize!(P, |p| ::fbthrift::protocol::write_message(
p,
"execute",
::fbthrift::MessageType::Call,
0,
|p| {
p.write_struct_begin("args");
p.write_field_begin("arg_sessionId", ::fbthrift::TType::I64, 1i16);
::fbthrift::Serialize::write(&arg_sessionId, p);
p.write_field_end();
p.write_field_begin("arg_stmt", ::fbthrift::TType::String, 2i16);
::fbthrift::Serialize::write(&arg_stmt, p);
p.write_field_end();
p.write_field_stop();
p.write_struct_end();
},
));
self.transport()
.call(request)
.map_err(::std::convert::From::from)
.and_then(|reply| ::futures::future::ready({
let de = P::deserializer(reply);
move |mut p: P::Deserializer| -> ::std::result::Result<crate::types::ExecutionResponse, crate::errors::graph_service::ExecuteError> {
let p = &mut p;
let (_, message_type, _) = p.read_message_begin(|_| ())?;
let result = match message_type {
::fbthrift::MessageType::Reply => {
let exn: crate::services::graph_service::ExecuteExn = ::fbthrift::Deserialize::read(p)?;
match exn {
crate::services::graph_service::ExecuteExn::Success(x) => ::std::result::Result::Ok(x),
crate::services::graph_service::ExecuteExn::ApplicationException(ae) => {
::std::result::Result::Err(crate::errors::graph_service::ExecuteError::ApplicationException(ae))
}
}
}
::fbthrift::MessageType::Exception => {
let ae: ::fbthrift::ApplicationException = ::fbthrift::Deserialize::read(p)?;
::std::result::Result::Err(crate::errors::graph_service::ExecuteError::ApplicationException(ae))
}
::fbthrift::MessageType::Call | ::fbthrift::MessageType::Oneway | ::fbthrift::MessageType::InvalidMessageType => {
let err = ::anyhow::anyhow!("Unexpected message type {:?}", message_type);
::std::result::Result::Err(crate::errors::graph_service::ExecuteError::ThriftError(err))
}
};
p.read_message_end()?;
result
}(de)
}))
.boxed()
}
}
impl<'a, T> GraphService for T
where
T: ::std::convert::AsRef<dyn GraphService + 'a>,
T: ::std::marker::Send,
{
fn authenticate(
&self,
arg_username: &::std::primitive::str,
arg_password: &::std::primitive::str,
) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<crate::types::AuthResponse, crate::errors::graph_service::AuthenticateError>> + ::std::marker::Send + 'static>> {
self.as_ref().authenticate(
arg_username,
arg_password,
)
}
fn signout(
&self,
arg_sessionId: ::std::primitive::i64,
) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(), crate::errors::graph_service::SignoutError>> + ::std::marker::Send + 'static>> {
self.as_ref().signout(
arg_sessionId,
)
}
fn execute(
&self,
arg_sessionId: ::std::primitive::i64,
arg_stmt: &::std::primitive::str,
) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<crate::types::ExecutionResponse, crate::errors::graph_service::ExecuteError>> + ::std::marker::Send + 'static>> {
self.as_ref().execute(
arg_sessionId,
arg_stmt,
)
}
}
pub struct make_GraphService;
impl dyn GraphService {
pub fn new<P, T>(
protocol: P,
transport: T,
) -> ::std::sync::Arc<impl GraphService + ::std::marker::Send + 'static>
where
P: ::fbthrift::Protocol<Frame = T>,
T: ::fbthrift::Transport,
{
let _ = protocol;
::std::sync::Arc::new(GraphServiceImpl::<P, T>::new(transport))
}
}
impl ::fbthrift::ClientFactory for make_GraphService {
type Api = dyn GraphService + ::std::marker::Send + ::std::marker::Sync + 'static;
fn new<P, T>(protocol: P, transport: T) -> ::std::sync::Arc<Self::Api>
where
P: ::fbthrift::Protocol<Frame = T>,
T: ::fbthrift::Transport + ::std::marker::Sync,
{
GraphService::new(protocol, transport)
}
}
}
pub mod server {
#[::async_trait::async_trait]
pub trait GraphService: ::std::marker::Send + ::std::marker::Sync + 'static {
async fn authenticate(
&self,
_username: ::std::string::String,
_password: ::std::string::String,
) -> ::std::result::Result<crate::types::AuthResponse, crate::services::graph_service::AuthenticateExn> {
::std::result::Result::Err(crate::services::graph_service::AuthenticateExn::ApplicationException(
::fbthrift::ApplicationException::unimplemented_method(
"GraphService",
"authenticate",
),
))
}
async fn signout(
&self,
_sessionId: ::std::primitive::i64,
) -> ::std::result::Result<(), crate::services::graph_service::SignoutExn> {
::std::result::Result::Err(crate::services::graph_service::SignoutExn::ApplicationException(
::fbthrift::ApplicationException::unimplemented_method(
"GraphService",
"signout",
),
))
}
async fn execute(
&self,
_sessionId: ::std::primitive::i64,
_stmt: ::std::string::String,
) -> ::std::result::Result<crate::types::ExecutionResponse, crate::services::graph_service::ExecuteExn> {
::std::result::Result::Err(crate::services::graph_service::ExecuteExn::ApplicationException(
::fbthrift::ApplicationException::unimplemented_method(
"GraphService",
"execute",
),
))
}
}
#[derive(Clone, Debug)]
pub struct GraphServiceProcessor<P, H, R> {
service: H,
supa: ::fbthrift::NullServiceProcessor<P, R>,
_phantom: ::std::marker::PhantomData<(P, H, R)>,
}
impl<P, H, R> GraphServiceProcessor<P, H, R>
where
P: ::fbthrift::Protocol + ::std::marker::Send + ::std::marker::Sync + 'static,
P::Deserializer: ::std::marker::Send,
H: GraphService,
{
pub fn new(service: H) -> Self {
Self {
service,
supa: ::fbthrift::NullServiceProcessor::new(),
_phantom: ::std::marker::PhantomData,
}
}
pub fn into_inner(self) -> H {
self.service
}
async fn handle_authenticate<'a>(
&'a self,
p: &'a mut P::Deserializer,
_req_ctxt: &R,
seqid: ::std::primitive::u32,
) -> ::anyhow::Result<::fbthrift::ProtocolEncodedFinal<P>> {
use ::fbthrift::ProtocolReader as _;
let mut field_username = ::std::option::Option::None;
let mut field_password = ::std::option::Option::None;
let _ = p.read_struct_begin(|_| ())?;
loop {
let (_, fty, fid) = p.read_field_begin(|_| ())?;
match (fty, fid as ::std::primitive::i32) {
(::fbthrift::TType::Stop, _) => break,
(::fbthrift::TType::String, 1) => field_username = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::String, 2) => field_password = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(fty, _) => p.skip(fty)?,
}
p.read_field_end()?;
}
p.read_struct_end()?;
let res = self.service.authenticate(
field_username.ok_or_else(|| {
::fbthrift::ApplicationException::missing_arg(
"authenticate",
"username",
)
})?,
field_password.ok_or_else(|| {
::fbthrift::ApplicationException::missing_arg(
"authenticate",
"password",
)
})?,
).await;
let res = match res {
::std::result::Result::Ok(res) => {
crate::services::graph_service::AuthenticateExn::Success(res)
}
::std::result::Result::Err(crate::services::graph_service::AuthenticateExn::ApplicationException(aexn)) => {
return ::std::result::Result::Err(aexn.into())
}
::std::result::Result::Err(crate::services::graph_service::AuthenticateExn::Success(_)) => {
panic!(
"{} attempted to return success via error",
"authenticate",
)
}
};
let res = ::fbthrift::serialize!(P, |p| ::fbthrift::protocol::write_message(
p,
"authenticate",
::fbthrift::MessageType::Reply,
seqid,
|p| ::fbthrift::Serialize::write(&res, p),
));
::std::result::Result::Ok(res)
}
async fn handle_signout<'a>(
&'a self,
p: &'a mut P::Deserializer,
_req_ctxt: &R,
seqid: ::std::primitive::u32,
) -> ::anyhow::Result<::fbthrift::ProtocolEncodedFinal<P>> {
use ::fbthrift::ProtocolReader as _;
let mut field_sessionId = ::std::option::Option::None;
let _ = p.read_struct_begin(|_| ())?;
loop {
let (_, fty, fid) = p.read_field_begin(|_| ())?;
match (fty, fid as ::std::primitive::i32) {
(::fbthrift::TType::Stop, _) => break,
(::fbthrift::TType::I64, 1) => field_sessionId = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(fty, _) => p.skip(fty)?,
}
p.read_field_end()?;
}
p.read_struct_end()?;
let res = self.service.signout(
field_sessionId.ok_or_else(|| {
::fbthrift::ApplicationException::missing_arg(
"signout",
"sessionId",
)
})?,
).await;
let res = match res {
::std::result::Result::Ok(res) => {
crate::services::graph_service::SignoutExn::Success(res)
}
::std::result::Result::Err(crate::services::graph_service::SignoutExn::ApplicationException(aexn)) => {
return ::std::result::Result::Err(aexn.into())
}
::std::result::Result::Err(crate::services::graph_service::SignoutExn::Success(_)) => {
panic!(
"{} attempted to return success via error",
"signout",
)
}
};
let res = ::fbthrift::serialize!(P, |p| ::fbthrift::protocol::write_message(
p,
"signout",
::fbthrift::MessageType::Reply,
seqid,
|p| ::fbthrift::Serialize::write(&res, p),
));
::std::result::Result::Ok(res)
}
async fn handle_execute<'a>(
&'a self,
p: &'a mut P::Deserializer,
_req_ctxt: &R,
seqid: ::std::primitive::u32,
) -> ::anyhow::Result<::fbthrift::ProtocolEncodedFinal<P>> {
use ::fbthrift::ProtocolReader as _;
let mut field_sessionId = ::std::option::Option::None;
let mut field_stmt = ::std::option::Option::None;
let _ = p.read_struct_begin(|_| ())?;
loop {
let (_, fty, fid) = p.read_field_begin(|_| ())?;
match (fty, fid as ::std::primitive::i32) {
(::fbthrift::TType::Stop, _) => break,
(::fbthrift::TType::I64, 1) => field_sessionId = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::String, 2) => field_stmt = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(fty, _) => p.skip(fty)?,
}
p.read_field_end()?;
}
p.read_struct_end()?;
let res = self.service.execute(
field_sessionId.ok_or_else(|| {
::fbthrift::ApplicationException::missing_arg(
"execute",
"sessionId",
)
})?,
field_stmt.ok_or_else(|| {
::fbthrift::ApplicationException::missing_arg(
"execute",
"stmt",
)
})?,
).await;
let res = match res {
::std::result::Result::Ok(res) => {
crate::services::graph_service::ExecuteExn::Success(res)
}
::std::result::Result::Err(crate::services::graph_service::ExecuteExn::ApplicationException(aexn)) => {
return ::std::result::Result::Err(aexn.into())
}
::std::result::Result::Err(crate::services::graph_service::ExecuteExn::Success(_)) => {
panic!(
"{} attempted to return success via error",
"execute",
)
}
};
let res = ::fbthrift::serialize!(P, |p| ::fbthrift::protocol::write_message(
p,
"execute",
::fbthrift::MessageType::Reply,
seqid,
|p| ::fbthrift::Serialize::write(&res, p),
));
::std::result::Result::Ok(res)
}
}
#[::async_trait::async_trait]
impl<P, H, R> ::fbthrift::ServiceProcessor<P> for GraphServiceProcessor<P, H, R>
where
P: ::fbthrift::Protocol + ::std::marker::Send + ::std::marker::Sync + 'static,
P::Deserializer: ::std::marker::Send,
H: GraphService,
R: ::std::marker::Send + ::std::marker::Sync + 'static,
{
type RequestContext = R;
#[inline]
fn method_idx(&self, name: &[::std::primitive::u8]) -> ::std::result::Result<::std::primitive::usize, ::fbthrift::ApplicationException> {
match name {
b"authenticate" => ::std::result::Result::Ok(0usize),
b"signout" => ::std::result::Result::Ok(1usize),
b"execute" => ::std::result::Result::Ok(2usize),
_ => ::std::result::Result::Err(::fbthrift::ApplicationException::unknown_method()),
}
}
async fn handle_method(
&self,
idx: ::std::primitive::usize,
_p: &mut P::Deserializer,
_r: &R,
_seqid: ::std::primitive::u32,
) -> ::anyhow::Result<::fbthrift::ProtocolEncodedFinal<P>> {
match idx {
0usize => self.handle_authenticate(_p, _r, _seqid).await,
1usize => self.handle_signout(_p, _r, _seqid).await,
2usize => self.handle_execute(_p, _r, _seqid).await,
bad => panic!(
"{}: unexpected method idx {}",
"GraphServiceProcessor",
bad
),
}
}
}
#[::async_trait::async_trait]
impl<P, H, R> ::fbthrift::ThriftService<P::Frame> for GraphServiceProcessor<P, H, R>
where
P: ::fbthrift::Protocol + ::std::marker::Send + ::std::marker::Sync + 'static,
P::Deserializer: ::std::marker::Send,
P::Frame: ::std::marker::Send + 'static,
H: GraphService,
R: ::std::marker::Send + ::std::marker::Sync + 'static,
{
type Handler = H;
type RequestContext = R;
async fn call(
&self,
req: ::fbthrift::ProtocolDecoded<P>,
req_ctxt: &R,
) -> ::anyhow::Result<::fbthrift::ProtocolEncodedFinal<P>> {
use ::fbthrift::{BufExt as _, ProtocolReader as _, ServiceProcessor as _};
let mut p = P::deserializer(req);
let (idx, mty, seqid) = p.read_message_begin(|name| self.method_idx(name))?;
if mty != ::fbthrift::MessageType::Call {
return ::std::result::Result::Err(::std::convert::From::from(::fbthrift::ApplicationException::new(
::fbthrift::ApplicationExceptionErrorCode::InvalidMessageType,
format!("message type {:?} not handled", mty)
)));
}
let idx = match idx {
::std::result::Result::Ok(idx) => idx,
::std::result::Result::Err(_) => {
let cur = P::into_buffer(p).reset();
return self.supa.call(cur, req_ctxt).await;
}
};
let res = self.handle_method(idx, &mut p, req_ctxt, seqid).await;
p.read_message_end()?;
match res {
::std::result::Result::Ok(bytes) => ::std::result::Result::Ok(bytes),
::std::result::Result::Err(err) => match err.downcast_ref::<::fbthrift::ProtocolError>() {
::std::option::Option::Some(::fbthrift::ProtocolError::ApplicationException(ae)) => {
let res = ::fbthrift::serialize!(P, |p| {
::fbthrift::protocol::write_message(
p,
"GraphServiceProcessor",
::fbthrift::MessageType::Exception,
seqid,
|p| ::fbthrift::Serialize::write(&ae, p),
)
});
::std::result::Result::Ok(res)
}
_ => ::std::result::Result::Err(err),
},
}
}
}
pub fn make_GraphService_server<F, H, R>(
proto: ::fbthrift::ProtocolID,
handler: H,
) -> ::std::result::Result<::std::boxed::Box<dyn ::fbthrift::ThriftService<F, Handler = H, RequestContext = R> + ::std::marker::Send + 'static>, ::fbthrift::ApplicationException>
where
F: ::fbthrift::Framing + ::std::marker::Send + ::std::marker::Sync + 'static,
H: GraphService,
R: ::std::marker::Send + ::std::marker::Sync + 'static,
{
match proto {
::fbthrift::ProtocolID::BinaryProtocol => {
::std::result::Result::Ok(::std::boxed::Box::new(GraphServiceProcessor::<::fbthrift::BinaryProtocol<F>, H, R>::new(handler)))
}
::fbthrift::ProtocolID::CompactProtocol => {
::std::result::Result::Ok(::std::boxed::Box::new(GraphServiceProcessor::<::fbthrift::CompactProtocol<F>, H, R>::new(handler)))
}
bad => ::std::result::Result::Err(::fbthrift::ApplicationException::invalid_protocol(bad)),
}
}
}
pub mod mock {
pub struct GraphService<'mock> {
pub authenticate: r#impl::graph_service::authenticate<'mock>,
pub signout: r#impl::graph_service::signout<'mock>,
pub execute: r#impl::graph_service::execute<'mock>,
_marker: ::std::marker::PhantomData<&'mock ()>,
}
impl dyn super::client::GraphService {
pub fn mock<'mock>() -> GraphService<'mock> {
GraphService {
authenticate: r#impl::graph_service::authenticate::unimplemented(),
signout: r#impl::graph_service::signout::unimplemented(),
execute: r#impl::graph_service::execute::unimplemented(),
_marker: ::std::marker::PhantomData,
}
}
}
#[::async_trait::async_trait]
impl<'mock> super::client::GraphService for GraphService<'mock> {
fn authenticate(
&self,
arg_username: &::std::primitive::str,
arg_password: &::std::primitive::str,
) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<crate::types::AuthResponse, crate::errors::graph_service::AuthenticateError>> + ::std::marker::Send + 'static>> {
let mut closure = self.authenticate.closure.lock().unwrap();
let closure: &mut dyn ::std::ops::FnMut(::std::string::String, ::std::string::String) -> _ = &mut **closure;
::std::boxed::Box::pin(::futures::future::ready(closure(arg_username.to_owned(), arg_password.to_owned())))
}
fn signout(
&self,
arg_sessionId: ::std::primitive::i64,
) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(), crate::errors::graph_service::SignoutError>> + ::std::marker::Send + 'static>> {
let mut closure = self.signout.closure.lock().unwrap();
let closure: &mut dyn ::std::ops::FnMut(::std::primitive::i64) -> _ = &mut **closure;
::std::boxed::Box::pin(::futures::future::ready(closure(arg_sessionId.clone())))
}
fn execute(
&self,
arg_sessionId: ::std::primitive::i64,
arg_stmt: &::std::primitive::str,
) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<crate::types::ExecutionResponse, crate::errors::graph_service::ExecuteError>> + ::std::marker::Send + 'static>> {
let mut closure = self.execute.closure.lock().unwrap();
let closure: &mut dyn ::std::ops::FnMut(::std::primitive::i64, ::std::string::String) -> _ = &mut **closure;
::std::boxed::Box::pin(::futures::future::ready(closure(arg_sessionId.clone(), arg_stmt.to_owned())))
}
}
mod r#impl {
pub mod graph_service {
pub struct authenticate<'mock> {
pub(crate) closure: ::std::sync::Mutex<::std::boxed::Box<
dyn ::std::ops::FnMut(::std::string::String, ::std::string::String) -> ::std::result::Result<
crate::types::AuthResponse,
crate::errors::graph_service::AuthenticateError,
> + ::std::marker::Send + ::std::marker::Sync + 'mock,
>>,
}
impl<'mock> authenticate<'mock> {
pub fn unimplemented() -> Self {
authenticate {
closure: ::std::sync::Mutex::new(::std::boxed::Box::new(|_: ::std::string::String, _: ::std::string::String| panic!(
"{}::{} is not mocked",
"GraphService",
"authenticate",
))),
}
}
pub fn ret(&self, value: crate::types::AuthResponse) {
self.mock(move |_: ::std::string::String, _: ::std::string::String| value.clone());
}
pub fn mock(&self, mut mock: impl ::std::ops::FnMut(::std::string::String, ::std::string::String) -> crate::types::AuthResponse + ::std::marker::Send + ::std::marker::Sync + 'mock) {
let mut closure = self.closure.lock().unwrap();
*closure = ::std::boxed::Box::new(move |username, password| ::std::result::Result::Ok(mock(username, password)));
}
pub fn throw<E>(&self, exception: E)
where
E: ::std::convert::Into<crate::errors::graph_service::AuthenticateError>,
E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock,
{
let mut closure = self.closure.lock().unwrap();
*closure = ::std::boxed::Box::new(move |_: ::std::string::String, _: ::std::string::String| ::std::result::Result::Err(exception.clone().into()));
}
}
pub struct signout<'mock> {
pub(crate) closure: ::std::sync::Mutex<::std::boxed::Box<
dyn ::std::ops::FnMut(::std::primitive::i64) -> ::std::result::Result<
(),
crate::errors::graph_service::SignoutError,
> + ::std::marker::Send + ::std::marker::Sync + 'mock,
>>,
}
impl<'mock> signout<'mock> {
pub fn unimplemented() -> Self {
signout {
closure: ::std::sync::Mutex::new(::std::boxed::Box::new(|_: ::std::primitive::i64| panic!(
"{}::{} is not mocked",
"GraphService",
"signout",
))),
}
}
pub fn ret(&self, value: ()) {
self.mock(move |_: ::std::primitive::i64| value.clone());
}
pub fn mock(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64) -> () + ::std::marker::Send + ::std::marker::Sync + 'mock) {
let mut closure = self.closure.lock().unwrap();
*closure = ::std::boxed::Box::new(move |sessionId| ::std::result::Result::Ok(mock(sessionId)));
}
pub fn throw<E>(&self, exception: E)
where
E: ::std::convert::Into<crate::errors::graph_service::SignoutError>,
E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock,
{
let mut closure = self.closure.lock().unwrap();
*closure = ::std::boxed::Box::new(move |_: ::std::primitive::i64| ::std::result::Result::Err(exception.clone().into()));
}
}
pub struct execute<'mock> {
pub(crate) closure: ::std::sync::Mutex<::std::boxed::Box<
dyn ::std::ops::FnMut(::std::primitive::i64, ::std::string::String) -> ::std::result::Result<
crate::types::ExecutionResponse,
crate::errors::graph_service::ExecuteError,
> + ::std::marker::Send + ::std::marker::Sync + 'mock,
>>,
}
impl<'mock> execute<'mock> {
pub fn unimplemented() -> Self {
execute {
closure: ::std::sync::Mutex::new(::std::boxed::Box::new(|_: ::std::primitive::i64, _: ::std::string::String| panic!(
"{}::{} is not mocked",
"GraphService",
"execute",
))),
}
}
pub fn ret(&self, value: crate::types::ExecutionResponse) {
self.mock(move |_: ::std::primitive::i64, _: ::std::string::String| value.clone());
}
pub fn mock(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64, ::std::string::String) -> crate::types::ExecutionResponse + ::std::marker::Send + ::std::marker::Sync + 'mock) {
let mut closure = self.closure.lock().unwrap();
*closure = ::std::boxed::Box::new(move |sessionId, stmt| ::std::result::Result::Ok(mock(sessionId, stmt)));
}
pub fn throw<E>(&self, exception: E)
where
E: ::std::convert::Into<crate::errors::graph_service::ExecuteError>,
E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock,
{
let mut closure = self.closure.lock().unwrap();
*closure = ::std::boxed::Box::new(move |_: ::std::primitive::i64, _: ::std::string::String| ::std::result::Result::Err(exception.clone().into()));
}
}
}
}
}
pub mod errors {
pub mod graph_service {
pub type AuthenticateError = ::fbthrift::NonthrowingFunctionError;
pub type SignoutError = ::fbthrift::NonthrowingFunctionError;
pub type ExecuteError = ::fbthrift::NonthrowingFunctionError;
}
}