#![allow(unused_imports)]
#![allow(unused_extern_crates)]
#![cfg_attr(feature = "cargo-clippy", allow(too_many_arguments, type_complexity))]
#![cfg_attr(rustfmt, rustfmt_skip)]
extern crate ordered_float;
extern crate thrift;
extern crate try_from;
use ordered_float::OrderedFloat;
use std::cell::RefCell;
use std::collections::{BTreeMap, BTreeSet};
use std::convert::From;
use std::default::Default;
use std::error::Error;
use std::fmt;
use std::fmt::{Display, Formatter};
use std::rc::Rc;
use try_from::TryFrom;
use thrift::{ApplicationError, ApplicationErrorKind, ProtocolError, ProtocolErrorKind, TThriftClient};
use thrift::protocol::{TFieldIdentifier, TListIdentifier, TMapIdentifier, TMessageIdentifier, TMessageType, TInputProtocol, TOutputProtocol, TSetIdentifier, TStructIdentifier, TType};
use thrift::protocol::field_id;
use thrift::protocol::verify_expected_message_type;
use thrift::protocol::verify_expected_sequence_number;
use thrift::protocol::verify_expected_service_call;
use thrift::protocol::verify_required_field_exists;
use thrift::server::TProcessor;
#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum ServiceLaunchEventType {
LowPowerStartOver = 0,
HighPowerStartOver = 1,
BackToLowerPowerOver = 2,
HighPowerRecoverOver = 3,
SingleServiceStarted = 4,
SingleServiceStopped = 5,
ResetLayer1Services = 6,
Layer1ServicesResetOver = 7,
}
impl ServiceLaunchEventType {
pub fn write_to_out_protocol(&self, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
o_prot.write_i32(*self as i32)
}
pub fn read_from_in_protocol(i_prot: &mut TInputProtocol) -> thrift::Result<ServiceLaunchEventType> {
let enum_value = i_prot.read_i32()?;
ServiceLaunchEventType::try_from(enum_value) }
}
impl TryFrom<i32> for ServiceLaunchEventType {
type Err = thrift::Error; fn try_from(i: i32) -> Result<Self, Self::Err> {
match i {
0 => Ok(ServiceLaunchEventType::LowPowerStartOver),
1 => Ok(ServiceLaunchEventType::HighPowerStartOver),
2 => Ok(ServiceLaunchEventType::BackToLowerPowerOver),
3 => Ok(ServiceLaunchEventType::HighPowerRecoverOver),
4 => Ok(ServiceLaunchEventType::SingleServiceStarted),
5 => Ok(ServiceLaunchEventType::SingleServiceStopped),
6 => Ok(ServiceLaunchEventType::ResetLayer1Services),
7 => Ok(ServiceLaunchEventType::Layer1ServicesResetOver),
_ => {
Err(
thrift::Error::Protocol(
ProtocolError::new(
ProtocolErrorKind::InvalidData,
format!("cannot convert enum constant {} to ServiceLaunchEventType", i)
)
)
)
},
}
}
}
#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum UserShellEventType {
Login = 0,
Logout = 1,
}
impl UserShellEventType {
pub fn write_to_out_protocol(&self, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
o_prot.write_i32(*self as i32)
}
pub fn read_from_in_protocol(i_prot: &mut TInputProtocol) -> thrift::Result<UserShellEventType> {
let enum_value = i_prot.read_i32()?;
UserShellEventType::try_from(enum_value) }
}
impl TryFrom<i32> for UserShellEventType {
type Err = thrift::Error; fn try_from(i: i32) -> Result<Self, Self::Err> {
match i {
0 => Ok(UserShellEventType::Login),
1 => Ok(UserShellEventType::Logout),
_ => {
Err(
thrift::Error::Protocol(
ProtocolError::new(
ProtocolErrorKind::InvalidData,
format!("cannot convert enum constant {} to UserShellEventType", i)
)
)
)
},
}
}
}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ServiceLaunchEvent {
pub event_type: Option<i32>,
pub last_service_i_d: Option<String>,
}
impl ServiceLaunchEvent {
pub fn new<F1, F2>(event_type: F1, last_service_i_d: F2) -> ServiceLaunchEvent where F1: Into<Option<i32>>, F2: Into<Option<String>> {
ServiceLaunchEvent {
event_type: event_type.into(),
last_service_i_d: last_service_i_d.into(),
}
}
pub fn read_from_in_protocol(i_prot: &mut TInputProtocol) -> thrift::Result<ServiceLaunchEvent> {
i_prot.read_struct_begin()?;
let mut f_1: Option<i32> = Some(0);
let mut f_2: Option<String> = Some("".to_owned());
loop {
let field_ident = i_prot.read_field_begin()?;
if field_ident.field_type == TType::Stop {
break;
}
let field_id = field_id(&field_ident)?;
match field_id {
1 => {
let val = i_prot.read_i32()?;
f_1 = Some(val);
},
2 => {
let val = i_prot.read_string()?;
f_2 = Some(val);
},
_ => {
i_prot.skip(field_ident.field_type)?;
},
};
i_prot.read_field_end()?;
}
i_prot.read_struct_end()?;
let ret = ServiceLaunchEvent {
event_type: f_1,
last_service_i_d: f_2,
};
Ok(ret)
}
pub fn write_to_out_protocol(&self, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
let struct_ident = TStructIdentifier::new("ServiceLaunchEvent");
o_prot.write_struct_begin(&struct_ident)?;
if let Some(fld_var) = self.event_type {
o_prot.write_field_begin(&TFieldIdentifier::new("EventType", TType::I32, 1))?;
o_prot.write_i32(fld_var)?;
o_prot.write_field_end()?;
()
} else {
()
}
if let Some(ref fld_var) = self.last_service_i_d {
o_prot.write_field_begin(&TFieldIdentifier::new("LastServiceID", TType::String, 2))?;
o_prot.write_string(fld_var)?;
o_prot.write_field_end()?;
()
} else {
()
}
o_prot.write_field_stop()?;
o_prot.write_struct_end()
}
}
impl Default for ServiceLaunchEvent {
fn default() -> Self {
ServiceLaunchEvent{
event_type: Some(0),
last_service_i_d: Some("".to_owned()),
}
}
}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct UserShellEvent {
pub event_type: Option<UserShellEventType>,
}
impl UserShellEvent {
pub fn new<F1>(event_type: F1) -> UserShellEvent where F1: Into<Option<UserShellEventType>> {
UserShellEvent {
event_type: event_type.into(),
}
}
pub fn read_from_in_protocol(i_prot: &mut TInputProtocol) -> thrift::Result<UserShellEvent> {
i_prot.read_struct_begin()?;
let mut f_1: Option<UserShellEventType> = None;
loop {
let field_ident = i_prot.read_field_begin()?;
if field_ident.field_type == TType::Stop {
break;
}
let field_id = field_id(&field_ident)?;
match field_id {
1 => {
let val = UserShellEventType::read_from_in_protocol(i_prot)?;
f_1 = Some(val);
},
_ => {
i_prot.skip(field_ident.field_type)?;
},
};
i_prot.read_field_end()?;
}
i_prot.read_struct_end()?;
let ret = UserShellEvent {
event_type: f_1,
};
Ok(ret)
}
pub fn write_to_out_protocol(&self, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
let struct_ident = TStructIdentifier::new("UserShellEvent");
o_prot.write_struct_begin(&struct_ident)?;
if let Some(ref fld_var) = self.event_type {
o_prot.write_field_begin(&TFieldIdentifier::new("EventType", TType::I32, 1))?;
fld_var.write_to_out_protocol(o_prot)?;
o_prot.write_field_end()?;
()
} else {
()
}
o_prot.write_field_stop()?;
o_prot.write_struct_end()
}
}
impl Default for UserShellEvent {
fn default() -> Self {
UserShellEvent{
event_type: None,
}
}
}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PubHeader {
pub payload_type: Option<String>,
}
impl PubHeader {
pub fn new<F1>(payload_type: F1) -> PubHeader where F1: Into<Option<String>> {
PubHeader {
payload_type: payload_type.into(),
}
}
pub fn read_from_in_protocol(i_prot: &mut TInputProtocol) -> thrift::Result<PubHeader> {
i_prot.read_struct_begin()?;
let mut f_1: Option<String> = Some("".to_owned());
loop {
let field_ident = i_prot.read_field_begin()?;
if field_ident.field_type == TType::Stop {
break;
}
let field_id = field_id(&field_ident)?;
match field_id {
1 => {
let val = i_prot.read_string()?;
f_1 = Some(val);
},
_ => {
i_prot.skip(field_ident.field_type)?;
},
};
i_prot.read_field_end()?;
}
i_prot.read_struct_end()?;
let ret = PubHeader {
payload_type: f_1,
};
Ok(ret)
}
pub fn write_to_out_protocol(&self, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
let struct_ident = TStructIdentifier::new("PubHeader");
o_prot.write_struct_begin(&struct_ident)?;
if let Some(ref fld_var) = self.payload_type {
o_prot.write_field_begin(&TFieldIdentifier::new("PayloadType", TType::String, 1))?;
o_prot.write_string(fld_var)?;
o_prot.write_field_end()?;
()
} else {
()
}
o_prot.write_field_stop()?;
o_prot.write_struct_end()
}
}
impl Default for PubHeader {
fn default() -> Self {
PubHeader{
payload_type: Some("".to_owned()),
}
}
}
pub const LAYER0_SERVICE_CHANNEL: &str = "layer0/service";
pub const SERVICE_INPUT_CHANNEL: &str = "service/input";