subor_rs/
input_manager_s_d_k_services.rs

1// Autogenerated by Thrift Compiler (0.12.0)
2// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
3
4#![allow(unused_imports)]
5#![allow(unused_extern_crates)]
6#![cfg_attr(feature = "cargo-clippy", allow(too_many_arguments, type_complexity))]
7#![cfg_attr(rustfmt, rustfmt_skip)]
8
9extern crate ordered_float;
10extern crate thrift;
11extern crate try_from;
12
13use ordered_float::OrderedFloat;
14use std::cell::RefCell;
15use std::collections::{BTreeMap, BTreeSet};
16use std::convert::From;
17use std::default::Default;
18use std::error::Error;
19use std::fmt;
20use std::fmt::{Display, Formatter};
21use std::rc::Rc;
22use try_from::TryFrom;
23
24use thrift::{ApplicationError, ApplicationErrorKind, ProtocolError, ProtocolErrorKind, TThriftClient};
25use thrift::protocol::{TFieldIdentifier, TListIdentifier, TMapIdentifier, TMessageIdentifier, TMessageType, TInputProtocol, TOutputProtocol, TSetIdentifier, TStructIdentifier, TType};
26use thrift::protocol::field_id;
27use thrift::protocol::verify_expected_message_type;
28use thrift::protocol::verify_expected_sequence_number;
29use thrift::protocol::verify_expected_service_call;
30use thrift::protocol::verify_required_field_exists;
31use thrift::server::TProcessor;
32
33use common_type_s_d_k_data_types;
34use input_manager_s_d_k_data_types;
35
36//
37// InputManagerService service client
38//
39
40pub trait TInputManagerServiceSyncClient {
41  /// Get the gamepads that are connected corrently
42  fn get_connected_gamepads(&mut self) -> thrift::Result<Vec<input_manager_s_d_k_data_types::GamepadInfo>>;
43  /// Activate the vibration of gamepad
44  fn set_gamepad_vibration(&mut self, device_id: String, motor1_value: i8, motor1_time: i8, motor2_value: i8, motor2_time: i8) -> thrift::Result<bool>;
45  /// Change the light of gamepad (for ruyi controller only)
46  fn set_gamepad_light(&mut self, device_id: String, r_value: i8, g_value: i8, b_value: i8) -> thrift::Result<bool>;
47  /// Obsolete. Temporary api the change the ruyi controller's state, will be removed later.
48  fn set_ruyi_controller_status(&mut self, channel: i8, enable_r: bool, enable_g: bool, enable_b: bool, enable_motor1: bool, enable_motor2: bool, shutdown: bool, r_value: i8, g_value: i8, b_value: i8, motor1_value: i8, motor1_time: i8, motor2_value: i8, motor2_time: i8) -> thrift::Result<bool>;
49}
50
51pub trait TInputManagerServiceSyncClientMarker {}
52
53pub struct InputManagerServiceSyncClient<IP, OP> where IP: TInputProtocol, OP: TOutputProtocol {
54  _i_prot: IP,
55  _o_prot: OP,
56  _sequence_number: i32,
57}
58
59impl <IP, OP> InputManagerServiceSyncClient<IP, OP> where IP: TInputProtocol, OP: TOutputProtocol {
60  pub fn new(input_protocol: IP, output_protocol: OP) -> InputManagerServiceSyncClient<IP, OP> {
61    InputManagerServiceSyncClient { _i_prot: input_protocol, _o_prot: output_protocol, _sequence_number: 0 }
62  }
63}
64
65impl <IP, OP> TThriftClient for InputManagerServiceSyncClient<IP, OP> where IP: TInputProtocol, OP: TOutputProtocol {
66  fn i_prot_mut(&mut self) -> &mut TInputProtocol { &mut self._i_prot }
67  fn o_prot_mut(&mut self) -> &mut TOutputProtocol { &mut self._o_prot }
68  fn sequence_number(&self) -> i32 { self._sequence_number }
69  fn increment_sequence_number(&mut self) -> i32 { self._sequence_number += 1; self._sequence_number }
70}
71
72impl <IP, OP> TInputManagerServiceSyncClientMarker for InputManagerServiceSyncClient<IP, OP> where IP: TInputProtocol, OP: TOutputProtocol {}
73
74impl <C: TThriftClient + TInputManagerServiceSyncClientMarker> TInputManagerServiceSyncClient for C {
75  fn get_connected_gamepads(&mut self) -> thrift::Result<Vec<input_manager_s_d_k_data_types::GamepadInfo>> {
76    (
77      {
78        self.increment_sequence_number();
79        let message_ident = TMessageIdentifier::new("GetConnectedGamepads", TMessageType::Call, self.sequence_number());
80        let call_args = InputManagerServiceGetConnectedGamepadsArgs {  };
81        self.o_prot_mut().write_message_begin(&message_ident)?;
82        call_args.write_to_out_protocol(self.o_prot_mut())?;
83        self.o_prot_mut().write_message_end()?;
84        self.o_prot_mut().flush()
85      }
86    )?;
87    {
88      let message_ident = self.i_prot_mut().read_message_begin()?;
89      verify_expected_sequence_number(self.sequence_number(), message_ident.sequence_number)?;
90      verify_expected_service_call("GetConnectedGamepads", &message_ident.name)?;
91      if message_ident.message_type == TMessageType::Exception {
92        let remote_error = thrift::Error::read_application_error_from_in_protocol(self.i_prot_mut())?;
93        self.i_prot_mut().read_message_end()?;
94        return Err(thrift::Error::Application(remote_error))
95      }
96      verify_expected_message_type(TMessageType::Reply, message_ident.message_type)?;
97      let result = InputManagerServiceGetConnectedGamepadsResult::read_from_in_protocol(self.i_prot_mut())?;
98      self.i_prot_mut().read_message_end()?;
99      result.ok_or()
100    }
101  }
102  fn set_gamepad_vibration(&mut self, device_id: String, motor1_value: i8, motor1_time: i8, motor2_value: i8, motor2_time: i8) -> thrift::Result<bool> {
103    (
104      {
105        self.increment_sequence_number();
106        let message_ident = TMessageIdentifier::new("SetGamepadVibration", TMessageType::Call, self.sequence_number());
107        let call_args = InputManagerServiceSetGamepadVibrationArgs { device_id: device_id, motor1_value: motor1_value, motor1_time: motor1_time, motor2_value: motor2_value, motor2_time: motor2_time };
108        self.o_prot_mut().write_message_begin(&message_ident)?;
109        call_args.write_to_out_protocol(self.o_prot_mut())?;
110        self.o_prot_mut().write_message_end()?;
111        self.o_prot_mut().flush()
112      }
113    )?;
114    {
115      let message_ident = self.i_prot_mut().read_message_begin()?;
116      verify_expected_sequence_number(self.sequence_number(), message_ident.sequence_number)?;
117      verify_expected_service_call("SetGamepadVibration", &message_ident.name)?;
118      if message_ident.message_type == TMessageType::Exception {
119        let remote_error = thrift::Error::read_application_error_from_in_protocol(self.i_prot_mut())?;
120        self.i_prot_mut().read_message_end()?;
121        return Err(thrift::Error::Application(remote_error))
122      }
123      verify_expected_message_type(TMessageType::Reply, message_ident.message_type)?;
124      let result = InputManagerServiceSetGamepadVibrationResult::read_from_in_protocol(self.i_prot_mut())?;
125      self.i_prot_mut().read_message_end()?;
126      result.ok_or()
127    }
128  }
129  fn set_gamepad_light(&mut self, device_id: String, r_value: i8, g_value: i8, b_value: i8) -> thrift::Result<bool> {
130    (
131      {
132        self.increment_sequence_number();
133        let message_ident = TMessageIdentifier::new("SetGamepadLight", TMessageType::Call, self.sequence_number());
134        let call_args = InputManagerServiceSetGamepadLightArgs { device_id: device_id, r_value: r_value, g_value: g_value, b_value: b_value };
135        self.o_prot_mut().write_message_begin(&message_ident)?;
136        call_args.write_to_out_protocol(self.o_prot_mut())?;
137        self.o_prot_mut().write_message_end()?;
138        self.o_prot_mut().flush()
139      }
140    )?;
141    {
142      let message_ident = self.i_prot_mut().read_message_begin()?;
143      verify_expected_sequence_number(self.sequence_number(), message_ident.sequence_number)?;
144      verify_expected_service_call("SetGamepadLight", &message_ident.name)?;
145      if message_ident.message_type == TMessageType::Exception {
146        let remote_error = thrift::Error::read_application_error_from_in_protocol(self.i_prot_mut())?;
147        self.i_prot_mut().read_message_end()?;
148        return Err(thrift::Error::Application(remote_error))
149      }
150      verify_expected_message_type(TMessageType::Reply, message_ident.message_type)?;
151      let result = InputManagerServiceSetGamepadLightResult::read_from_in_protocol(self.i_prot_mut())?;
152      self.i_prot_mut().read_message_end()?;
153      result.ok_or()
154    }
155  }
156  fn set_ruyi_controller_status(&mut self, channel: i8, enable_r: bool, enable_g: bool, enable_b: bool, enable_motor1: bool, enable_motor2: bool, shutdown: bool, r_value: i8, g_value: i8, b_value: i8, motor1_value: i8, motor1_time: i8, motor2_value: i8, motor2_time: i8) -> thrift::Result<bool> {
157    (
158      {
159        self.increment_sequence_number();
160        let message_ident = TMessageIdentifier::new("SetRuyiControllerStatus", TMessageType::Call, self.sequence_number());
161        let call_args = InputManagerServiceSetRuyiControllerStatusArgs { channel: channel, enable_r: enable_r, enable_g: enable_g, enable_b: enable_b, enable_motor1: enable_motor1, enable_motor2: enable_motor2, shutdown: shutdown, r_value: r_value, g_value: g_value, b_value: b_value, motor1_value: motor1_value, motor1_time: motor1_time, motor2_value: motor2_value, motor2_time: motor2_time };
162        self.o_prot_mut().write_message_begin(&message_ident)?;
163        call_args.write_to_out_protocol(self.o_prot_mut())?;
164        self.o_prot_mut().write_message_end()?;
165        self.o_prot_mut().flush()
166      }
167    )?;
168    {
169      let message_ident = self.i_prot_mut().read_message_begin()?;
170      verify_expected_sequence_number(self.sequence_number(), message_ident.sequence_number)?;
171      verify_expected_service_call("SetRuyiControllerStatus", &message_ident.name)?;
172      if message_ident.message_type == TMessageType::Exception {
173        let remote_error = thrift::Error::read_application_error_from_in_protocol(self.i_prot_mut())?;
174        self.i_prot_mut().read_message_end()?;
175        return Err(thrift::Error::Application(remote_error))
176      }
177      verify_expected_message_type(TMessageType::Reply, message_ident.message_type)?;
178      let result = InputManagerServiceSetRuyiControllerStatusResult::read_from_in_protocol(self.i_prot_mut())?;
179      self.i_prot_mut().read_message_end()?;
180      result.ok_or()
181    }
182  }
183}
184
185//
186// InputManagerService service processor
187//
188
189pub trait InputManagerServiceSyncHandler {
190  /// Get the gamepads that are connected corrently
191  fn handle_get_connected_gamepads(&self) -> thrift::Result<Vec<input_manager_s_d_k_data_types::GamepadInfo>>;
192  /// Activate the vibration of gamepad
193  fn handle_set_gamepad_vibration(&self, device_id: String, motor1_value: i8, motor1_time: i8, motor2_value: i8, motor2_time: i8) -> thrift::Result<bool>;
194  /// Change the light of gamepad (for ruyi controller only)
195  fn handle_set_gamepad_light(&self, device_id: String, r_value: i8, g_value: i8, b_value: i8) -> thrift::Result<bool>;
196  /// Obsolete. Temporary api the change the ruyi controller's state, will be removed later.
197  fn handle_set_ruyi_controller_status(&self, channel: i8, enable_r: bool, enable_g: bool, enable_b: bool, enable_motor1: bool, enable_motor2: bool, shutdown: bool, r_value: i8, g_value: i8, b_value: i8, motor1_value: i8, motor1_time: i8, motor2_value: i8, motor2_time: i8) -> thrift::Result<bool>;
198}
199
200pub struct InputManagerServiceSyncProcessor<H: InputManagerServiceSyncHandler> {
201  handler: H,
202}
203
204impl <H: InputManagerServiceSyncHandler> InputManagerServiceSyncProcessor<H> {
205  pub fn new(handler: H) -> InputManagerServiceSyncProcessor<H> {
206    InputManagerServiceSyncProcessor {
207      handler,
208    }
209  }
210  fn process_get_connected_gamepads(&self, incoming_sequence_number: i32, i_prot: &mut TInputProtocol, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
211    TInputManagerServiceProcessFunctions::process_get_connected_gamepads(&self.handler, incoming_sequence_number, i_prot, o_prot)
212  }
213  fn process_set_gamepad_vibration(&self, incoming_sequence_number: i32, i_prot: &mut TInputProtocol, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
214    TInputManagerServiceProcessFunctions::process_set_gamepad_vibration(&self.handler, incoming_sequence_number, i_prot, o_prot)
215  }
216  fn process_set_gamepad_light(&self, incoming_sequence_number: i32, i_prot: &mut TInputProtocol, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
217    TInputManagerServiceProcessFunctions::process_set_gamepad_light(&self.handler, incoming_sequence_number, i_prot, o_prot)
218  }
219  fn process_set_ruyi_controller_status(&self, incoming_sequence_number: i32, i_prot: &mut TInputProtocol, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
220    TInputManagerServiceProcessFunctions::process_set_ruyi_controller_status(&self.handler, incoming_sequence_number, i_prot, o_prot)
221  }
222}
223
224pub struct TInputManagerServiceProcessFunctions;
225
226impl TInputManagerServiceProcessFunctions {
227  pub fn process_get_connected_gamepads<H: InputManagerServiceSyncHandler>(handler: &H, incoming_sequence_number: i32, i_prot: &mut TInputProtocol, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
228    let _ = InputManagerServiceGetConnectedGamepadsArgs::read_from_in_protocol(i_prot)?;
229    match handler.handle_get_connected_gamepads() {
230      Ok(handler_return) => {
231        let message_ident = TMessageIdentifier::new("GetConnectedGamepads", TMessageType::Reply, incoming_sequence_number);
232        o_prot.write_message_begin(&message_ident)?;
233        let ret = InputManagerServiceGetConnectedGamepadsResult { result_value: Some(handler_return) };
234        ret.write_to_out_protocol(o_prot)?;
235        o_prot.write_message_end()?;
236        o_prot.flush()
237      },
238      Err(e) => {
239        match e {
240          thrift::Error::Application(app_err) => {
241            let message_ident = TMessageIdentifier::new("GetConnectedGamepads", TMessageType::Exception, incoming_sequence_number);
242            o_prot.write_message_begin(&message_ident)?;
243            thrift::Error::write_application_error_to_out_protocol(&app_err, o_prot)?;
244            o_prot.write_message_end()?;
245            o_prot.flush()
246          },
247          _ => {
248            let ret_err = {
249              ApplicationError::new(
250                ApplicationErrorKind::Unknown,
251                e.description()
252              )
253            };
254            let message_ident = TMessageIdentifier::new("GetConnectedGamepads", TMessageType::Exception, incoming_sequence_number);
255            o_prot.write_message_begin(&message_ident)?;
256            thrift::Error::write_application_error_to_out_protocol(&ret_err, o_prot)?;
257            o_prot.write_message_end()?;
258            o_prot.flush()
259          },
260        }
261      },
262    }
263  }
264  pub fn process_set_gamepad_vibration<H: InputManagerServiceSyncHandler>(handler: &H, incoming_sequence_number: i32, i_prot: &mut TInputProtocol, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
265    let args = InputManagerServiceSetGamepadVibrationArgs::read_from_in_protocol(i_prot)?;
266    match handler.handle_set_gamepad_vibration(args.device_id, args.motor1_value, args.motor1_time, args.motor2_value, args.motor2_time) {
267      Ok(handler_return) => {
268        let message_ident = TMessageIdentifier::new("SetGamepadVibration", TMessageType::Reply, incoming_sequence_number);
269        o_prot.write_message_begin(&message_ident)?;
270        let ret = InputManagerServiceSetGamepadVibrationResult { result_value: Some(handler_return) };
271        ret.write_to_out_protocol(o_prot)?;
272        o_prot.write_message_end()?;
273        o_prot.flush()
274      },
275      Err(e) => {
276        match e {
277          thrift::Error::Application(app_err) => {
278            let message_ident = TMessageIdentifier::new("SetGamepadVibration", TMessageType::Exception, incoming_sequence_number);
279            o_prot.write_message_begin(&message_ident)?;
280            thrift::Error::write_application_error_to_out_protocol(&app_err, o_prot)?;
281            o_prot.write_message_end()?;
282            o_prot.flush()
283          },
284          _ => {
285            let ret_err = {
286              ApplicationError::new(
287                ApplicationErrorKind::Unknown,
288                e.description()
289              )
290            };
291            let message_ident = TMessageIdentifier::new("SetGamepadVibration", TMessageType::Exception, incoming_sequence_number);
292            o_prot.write_message_begin(&message_ident)?;
293            thrift::Error::write_application_error_to_out_protocol(&ret_err, o_prot)?;
294            o_prot.write_message_end()?;
295            o_prot.flush()
296          },
297        }
298      },
299    }
300  }
301  pub fn process_set_gamepad_light<H: InputManagerServiceSyncHandler>(handler: &H, incoming_sequence_number: i32, i_prot: &mut TInputProtocol, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
302    let args = InputManagerServiceSetGamepadLightArgs::read_from_in_protocol(i_prot)?;
303    match handler.handle_set_gamepad_light(args.device_id, args.r_value, args.g_value, args.b_value) {
304      Ok(handler_return) => {
305        let message_ident = TMessageIdentifier::new("SetGamepadLight", TMessageType::Reply, incoming_sequence_number);
306        o_prot.write_message_begin(&message_ident)?;
307        let ret = InputManagerServiceSetGamepadLightResult { result_value: Some(handler_return) };
308        ret.write_to_out_protocol(o_prot)?;
309        o_prot.write_message_end()?;
310        o_prot.flush()
311      },
312      Err(e) => {
313        match e {
314          thrift::Error::Application(app_err) => {
315            let message_ident = TMessageIdentifier::new("SetGamepadLight", TMessageType::Exception, incoming_sequence_number);
316            o_prot.write_message_begin(&message_ident)?;
317            thrift::Error::write_application_error_to_out_protocol(&app_err, o_prot)?;
318            o_prot.write_message_end()?;
319            o_prot.flush()
320          },
321          _ => {
322            let ret_err = {
323              ApplicationError::new(
324                ApplicationErrorKind::Unknown,
325                e.description()
326              )
327            };
328            let message_ident = TMessageIdentifier::new("SetGamepadLight", TMessageType::Exception, incoming_sequence_number);
329            o_prot.write_message_begin(&message_ident)?;
330            thrift::Error::write_application_error_to_out_protocol(&ret_err, o_prot)?;
331            o_prot.write_message_end()?;
332            o_prot.flush()
333          },
334        }
335      },
336    }
337  }
338  pub fn process_set_ruyi_controller_status<H: InputManagerServiceSyncHandler>(handler: &H, incoming_sequence_number: i32, i_prot: &mut TInputProtocol, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
339    let args = InputManagerServiceSetRuyiControllerStatusArgs::read_from_in_protocol(i_prot)?;
340    match handler.handle_set_ruyi_controller_status(args.channel, args.enable_r, args.enable_g, args.enable_b, args.enable_motor1, args.enable_motor2, args.shutdown, args.r_value, args.g_value, args.b_value, args.motor1_value, args.motor1_time, args.motor2_value, args.motor2_time) {
341      Ok(handler_return) => {
342        let message_ident = TMessageIdentifier::new("SetRuyiControllerStatus", TMessageType::Reply, incoming_sequence_number);
343        o_prot.write_message_begin(&message_ident)?;
344        let ret = InputManagerServiceSetRuyiControllerStatusResult { result_value: Some(handler_return) };
345        ret.write_to_out_protocol(o_prot)?;
346        o_prot.write_message_end()?;
347        o_prot.flush()
348      },
349      Err(e) => {
350        match e {
351          thrift::Error::Application(app_err) => {
352            let message_ident = TMessageIdentifier::new("SetRuyiControllerStatus", TMessageType::Exception, incoming_sequence_number);
353            o_prot.write_message_begin(&message_ident)?;
354            thrift::Error::write_application_error_to_out_protocol(&app_err, o_prot)?;
355            o_prot.write_message_end()?;
356            o_prot.flush()
357          },
358          _ => {
359            let ret_err = {
360              ApplicationError::new(
361                ApplicationErrorKind::Unknown,
362                e.description()
363              )
364            };
365            let message_ident = TMessageIdentifier::new("SetRuyiControllerStatus", TMessageType::Exception, incoming_sequence_number);
366            o_prot.write_message_begin(&message_ident)?;
367            thrift::Error::write_application_error_to_out_protocol(&ret_err, o_prot)?;
368            o_prot.write_message_end()?;
369            o_prot.flush()
370          },
371        }
372      },
373    }
374  }
375}
376
377impl <H: InputManagerServiceSyncHandler> TProcessor for InputManagerServiceSyncProcessor<H> {
378  fn process(&self, i_prot: &mut TInputProtocol, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
379    let message_ident = i_prot.read_message_begin()?;
380    let res = match &*message_ident.name {
381      "GetConnectedGamepads" => {
382        self.process_get_connected_gamepads(message_ident.sequence_number, i_prot, o_prot)
383      },
384      "SetGamepadVibration" => {
385        self.process_set_gamepad_vibration(message_ident.sequence_number, i_prot, o_prot)
386      },
387      "SetGamepadLight" => {
388        self.process_set_gamepad_light(message_ident.sequence_number, i_prot, o_prot)
389      },
390      "SetRuyiControllerStatus" => {
391        self.process_set_ruyi_controller_status(message_ident.sequence_number, i_prot, o_prot)
392      },
393      method => {
394        Err(
395          thrift::Error::Application(
396            ApplicationError::new(
397              ApplicationErrorKind::UnknownMethod,
398              format!("unknown method {}", method)
399            )
400          )
401        )
402      },
403    };
404    thrift::server::handle_process_result(&message_ident, res, o_prot)
405  }
406}
407
408//
409// InputManagerServiceGetConnectedGamepadsArgs
410//
411
412#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
413struct InputManagerServiceGetConnectedGamepadsArgs {
414}
415
416impl InputManagerServiceGetConnectedGamepadsArgs {
417  fn read_from_in_protocol(i_prot: &mut TInputProtocol) -> thrift::Result<InputManagerServiceGetConnectedGamepadsArgs> {
418    i_prot.read_struct_begin()?;
419    loop {
420      let field_ident = i_prot.read_field_begin()?;
421      if field_ident.field_type == TType::Stop {
422        break;
423      }
424      let field_id = field_id(&field_ident)?;
425      match field_id {
426        _ => {
427          i_prot.skip(field_ident.field_type)?;
428        },
429      };
430      i_prot.read_field_end()?;
431    }
432    i_prot.read_struct_end()?;
433    let ret = InputManagerServiceGetConnectedGamepadsArgs {};
434    Ok(ret)
435  }
436  fn write_to_out_protocol(&self, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
437    let struct_ident = TStructIdentifier::new("GetConnectedGamepads_args");
438    o_prot.write_struct_begin(&struct_ident)?;
439    o_prot.write_field_stop()?;
440    o_prot.write_struct_end()
441  }
442}
443
444//
445// InputManagerServiceGetConnectedGamepadsResult
446//
447
448#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
449struct InputManagerServiceGetConnectedGamepadsResult {
450  result_value: Option<Vec<input_manager_s_d_k_data_types::GamepadInfo>>,
451}
452
453impl InputManagerServiceGetConnectedGamepadsResult {
454  fn read_from_in_protocol(i_prot: &mut TInputProtocol) -> thrift::Result<InputManagerServiceGetConnectedGamepadsResult> {
455    i_prot.read_struct_begin()?;
456    let mut f_0: Option<Vec<input_manager_s_d_k_data_types::GamepadInfo>> = None;
457    loop {
458      let field_ident = i_prot.read_field_begin()?;
459      if field_ident.field_type == TType::Stop {
460        break;
461      }
462      let field_id = field_id(&field_ident)?;
463      match field_id {
464        0 => {
465          let list_ident = i_prot.read_list_begin()?;
466          let mut val: Vec<input_manager_s_d_k_data_types::GamepadInfo> = Vec::with_capacity(list_ident.size as usize);
467          for _ in 0..list_ident.size {
468            let list_elem_0 = input_manager_s_d_k_data_types::GamepadInfo::read_from_in_protocol(i_prot)?;
469            val.push(list_elem_0);
470          }
471          i_prot.read_list_end()?;
472          f_0 = Some(val);
473        },
474        _ => {
475          i_prot.skip(field_ident.field_type)?;
476        },
477      };
478      i_prot.read_field_end()?;
479    }
480    i_prot.read_struct_end()?;
481    let ret = InputManagerServiceGetConnectedGamepadsResult {
482      result_value: f_0,
483    };
484    Ok(ret)
485  }
486  fn write_to_out_protocol(&self, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
487    let struct_ident = TStructIdentifier::new("InputManagerServiceGetConnectedGamepadsResult");
488    o_prot.write_struct_begin(&struct_ident)?;
489    if let Some(ref fld_var) = self.result_value {
490      o_prot.write_field_begin(&TFieldIdentifier::new("result_value", TType::List, 0))?;
491      o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, fld_var.len() as i32))?;
492      for e in fld_var {
493        e.write_to_out_protocol(o_prot)?;
494        o_prot.write_list_end()?;
495      }
496      o_prot.write_field_end()?;
497      ()
498    } else {
499      ()
500    }
501    o_prot.write_field_stop()?;
502    o_prot.write_struct_end()
503  }
504  fn ok_or(self) -> thrift::Result<Vec<input_manager_s_d_k_data_types::GamepadInfo>> {
505    if self.result_value.is_some() {
506      Ok(self.result_value.unwrap())
507    } else {
508      Err(
509        thrift::Error::Application(
510          ApplicationError::new(
511            ApplicationErrorKind::MissingResult,
512            "no result received for InputManagerServiceGetConnectedGamepads"
513          )
514        )
515      )
516    }
517  }
518}
519
520//
521// InputManagerServiceSetGamepadVibrationArgs
522//
523
524#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
525struct InputManagerServiceSetGamepadVibrationArgs {
526  /// The deviceid of the gamepad
527  device_id: String,
528  /// @SetGamepadVibration_motor1Value_desc
529  motor1_value: i8,
530  /// @SetGamepadVibration_motor1Time_desc
531  motor1_time: i8,
532  /// @SetGamepadVibration_motor2Value_desc
533  motor2_value: i8,
534  /// @SetGamepadVibration_motor2Time_desc
535  motor2_time: i8,
536}
537
538impl InputManagerServiceSetGamepadVibrationArgs {
539  fn read_from_in_protocol(i_prot: &mut TInputProtocol) -> thrift::Result<InputManagerServiceSetGamepadVibrationArgs> {
540    i_prot.read_struct_begin()?;
541    let mut f_1: Option<String> = None;
542    let mut f_2: Option<i8> = None;
543    let mut f_3: Option<i8> = None;
544    let mut f_4: Option<i8> = None;
545    let mut f_5: Option<i8> = None;
546    loop {
547      let field_ident = i_prot.read_field_begin()?;
548      if field_ident.field_type == TType::Stop {
549        break;
550      }
551      let field_id = field_id(&field_ident)?;
552      match field_id {
553        1 => {
554          let val = i_prot.read_string()?;
555          f_1 = Some(val);
556        },
557        2 => {
558          let val = i_prot.read_i8()?;
559          f_2 = Some(val);
560        },
561        3 => {
562          let val = i_prot.read_i8()?;
563          f_3 = Some(val);
564        },
565        4 => {
566          let val = i_prot.read_i8()?;
567          f_4 = Some(val);
568        },
569        5 => {
570          let val = i_prot.read_i8()?;
571          f_5 = Some(val);
572        },
573        _ => {
574          i_prot.skip(field_ident.field_type)?;
575        },
576      };
577      i_prot.read_field_end()?;
578    }
579    i_prot.read_struct_end()?;
580    verify_required_field_exists("InputManagerServiceSetGamepadVibrationArgs.device_id", &f_1)?;
581    verify_required_field_exists("InputManagerServiceSetGamepadVibrationArgs.motor1_value", &f_2)?;
582    verify_required_field_exists("InputManagerServiceSetGamepadVibrationArgs.motor1_time", &f_3)?;
583    verify_required_field_exists("InputManagerServiceSetGamepadVibrationArgs.motor2_value", &f_4)?;
584    verify_required_field_exists("InputManagerServiceSetGamepadVibrationArgs.motor2_time", &f_5)?;
585    let ret = InputManagerServiceSetGamepadVibrationArgs {
586      device_id: f_1.expect("auto-generated code should have checked for presence of required fields"),
587      motor1_value: f_2.expect("auto-generated code should have checked for presence of required fields"),
588      motor1_time: f_3.expect("auto-generated code should have checked for presence of required fields"),
589      motor2_value: f_4.expect("auto-generated code should have checked for presence of required fields"),
590      motor2_time: f_5.expect("auto-generated code should have checked for presence of required fields"),
591    };
592    Ok(ret)
593  }
594  fn write_to_out_protocol(&self, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
595    let struct_ident = TStructIdentifier::new("SetGamepadVibration_args");
596    o_prot.write_struct_begin(&struct_ident)?;
597    o_prot.write_field_begin(&TFieldIdentifier::new("deviceId", TType::String, 1))?;
598    o_prot.write_string(&self.device_id)?;
599    o_prot.write_field_end()?;
600    o_prot.write_field_begin(&TFieldIdentifier::new("motor1Value", TType::I08, 2))?;
601    o_prot.write_i8(self.motor1_value)?;
602    o_prot.write_field_end()?;
603    o_prot.write_field_begin(&TFieldIdentifier::new("motor1Time", TType::I08, 3))?;
604    o_prot.write_i8(self.motor1_time)?;
605    o_prot.write_field_end()?;
606    o_prot.write_field_begin(&TFieldIdentifier::new("motor2Value", TType::I08, 4))?;
607    o_prot.write_i8(self.motor2_value)?;
608    o_prot.write_field_end()?;
609    o_prot.write_field_begin(&TFieldIdentifier::new("motor2Time", TType::I08, 5))?;
610    o_prot.write_i8(self.motor2_time)?;
611    o_prot.write_field_end()?;
612    o_prot.write_field_stop()?;
613    o_prot.write_struct_end()
614  }
615}
616
617//
618// InputManagerServiceSetGamepadVibrationResult
619//
620
621#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
622struct InputManagerServiceSetGamepadVibrationResult {
623  result_value: Option<bool>,
624}
625
626impl InputManagerServiceSetGamepadVibrationResult {
627  fn read_from_in_protocol(i_prot: &mut TInputProtocol) -> thrift::Result<InputManagerServiceSetGamepadVibrationResult> {
628    i_prot.read_struct_begin()?;
629    let mut f_0: Option<bool> = None;
630    loop {
631      let field_ident = i_prot.read_field_begin()?;
632      if field_ident.field_type == TType::Stop {
633        break;
634      }
635      let field_id = field_id(&field_ident)?;
636      match field_id {
637        0 => {
638          let val = i_prot.read_bool()?;
639          f_0 = Some(val);
640        },
641        _ => {
642          i_prot.skip(field_ident.field_type)?;
643        },
644      };
645      i_prot.read_field_end()?;
646    }
647    i_prot.read_struct_end()?;
648    let ret = InputManagerServiceSetGamepadVibrationResult {
649      result_value: f_0,
650    };
651    Ok(ret)
652  }
653  fn write_to_out_protocol(&self, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
654    let struct_ident = TStructIdentifier::new("InputManagerServiceSetGamepadVibrationResult");
655    o_prot.write_struct_begin(&struct_ident)?;
656    if let Some(fld_var) = self.result_value {
657      o_prot.write_field_begin(&TFieldIdentifier::new("result_value", TType::Bool, 0))?;
658      o_prot.write_bool(fld_var)?;
659      o_prot.write_field_end()?;
660      ()
661    } else {
662      ()
663    }
664    o_prot.write_field_stop()?;
665    o_prot.write_struct_end()
666  }
667  fn ok_or(self) -> thrift::Result<bool> {
668    if self.result_value.is_some() {
669      Ok(self.result_value.unwrap())
670    } else {
671      Err(
672        thrift::Error::Application(
673          ApplicationError::new(
674            ApplicationErrorKind::MissingResult,
675            "no result received for InputManagerServiceSetGamepadVibration"
676          )
677        )
678      )
679    }
680  }
681}
682
683//
684// InputManagerServiceSetGamepadLightArgs
685//
686
687#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
688struct InputManagerServiceSetGamepadLightArgs {
689  /// The device id of the gamepad
690  device_id: String,
691  r_value: i8,
692  g_value: i8,
693  b_value: i8,
694}
695
696impl InputManagerServiceSetGamepadLightArgs {
697  fn read_from_in_protocol(i_prot: &mut TInputProtocol) -> thrift::Result<InputManagerServiceSetGamepadLightArgs> {
698    i_prot.read_struct_begin()?;
699    let mut f_1: Option<String> = None;
700    let mut f_2: Option<i8> = None;
701    let mut f_3: Option<i8> = None;
702    let mut f_4: Option<i8> = None;
703    loop {
704      let field_ident = i_prot.read_field_begin()?;
705      if field_ident.field_type == TType::Stop {
706        break;
707      }
708      let field_id = field_id(&field_ident)?;
709      match field_id {
710        1 => {
711          let val = i_prot.read_string()?;
712          f_1 = Some(val);
713        },
714        2 => {
715          let val = i_prot.read_i8()?;
716          f_2 = Some(val);
717        },
718        3 => {
719          let val = i_prot.read_i8()?;
720          f_3 = Some(val);
721        },
722        4 => {
723          let val = i_prot.read_i8()?;
724          f_4 = Some(val);
725        },
726        _ => {
727          i_prot.skip(field_ident.field_type)?;
728        },
729      };
730      i_prot.read_field_end()?;
731    }
732    i_prot.read_struct_end()?;
733    verify_required_field_exists("InputManagerServiceSetGamepadLightArgs.device_id", &f_1)?;
734    verify_required_field_exists("InputManagerServiceSetGamepadLightArgs.r_value", &f_2)?;
735    verify_required_field_exists("InputManagerServiceSetGamepadLightArgs.g_value", &f_3)?;
736    verify_required_field_exists("InputManagerServiceSetGamepadLightArgs.b_value", &f_4)?;
737    let ret = InputManagerServiceSetGamepadLightArgs {
738      device_id: f_1.expect("auto-generated code should have checked for presence of required fields"),
739      r_value: f_2.expect("auto-generated code should have checked for presence of required fields"),
740      g_value: f_3.expect("auto-generated code should have checked for presence of required fields"),
741      b_value: f_4.expect("auto-generated code should have checked for presence of required fields"),
742    };
743    Ok(ret)
744  }
745  fn write_to_out_protocol(&self, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
746    let struct_ident = TStructIdentifier::new("SetGamepadLight_args");
747    o_prot.write_struct_begin(&struct_ident)?;
748    o_prot.write_field_begin(&TFieldIdentifier::new("deviceId", TType::String, 1))?;
749    o_prot.write_string(&self.device_id)?;
750    o_prot.write_field_end()?;
751    o_prot.write_field_begin(&TFieldIdentifier::new("RValue", TType::I08, 2))?;
752    o_prot.write_i8(self.r_value)?;
753    o_prot.write_field_end()?;
754    o_prot.write_field_begin(&TFieldIdentifier::new("GValue", TType::I08, 3))?;
755    o_prot.write_i8(self.g_value)?;
756    o_prot.write_field_end()?;
757    o_prot.write_field_begin(&TFieldIdentifier::new("BValue", TType::I08, 4))?;
758    o_prot.write_i8(self.b_value)?;
759    o_prot.write_field_end()?;
760    o_prot.write_field_stop()?;
761    o_prot.write_struct_end()
762  }
763}
764
765//
766// InputManagerServiceSetGamepadLightResult
767//
768
769#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
770struct InputManagerServiceSetGamepadLightResult {
771  result_value: Option<bool>,
772}
773
774impl InputManagerServiceSetGamepadLightResult {
775  fn read_from_in_protocol(i_prot: &mut TInputProtocol) -> thrift::Result<InputManagerServiceSetGamepadLightResult> {
776    i_prot.read_struct_begin()?;
777    let mut f_0: Option<bool> = None;
778    loop {
779      let field_ident = i_prot.read_field_begin()?;
780      if field_ident.field_type == TType::Stop {
781        break;
782      }
783      let field_id = field_id(&field_ident)?;
784      match field_id {
785        0 => {
786          let val = i_prot.read_bool()?;
787          f_0 = Some(val);
788        },
789        _ => {
790          i_prot.skip(field_ident.field_type)?;
791        },
792      };
793      i_prot.read_field_end()?;
794    }
795    i_prot.read_struct_end()?;
796    let ret = InputManagerServiceSetGamepadLightResult {
797      result_value: f_0,
798    };
799    Ok(ret)
800  }
801  fn write_to_out_protocol(&self, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
802    let struct_ident = TStructIdentifier::new("InputManagerServiceSetGamepadLightResult");
803    o_prot.write_struct_begin(&struct_ident)?;
804    if let Some(fld_var) = self.result_value {
805      o_prot.write_field_begin(&TFieldIdentifier::new("result_value", TType::Bool, 0))?;
806      o_prot.write_bool(fld_var)?;
807      o_prot.write_field_end()?;
808      ()
809    } else {
810      ()
811    }
812    o_prot.write_field_stop()?;
813    o_prot.write_struct_end()
814  }
815  fn ok_or(self) -> thrift::Result<bool> {
816    if self.result_value.is_some() {
817      Ok(self.result_value.unwrap())
818    } else {
819      Err(
820        thrift::Error::Application(
821          ApplicationError::new(
822            ApplicationErrorKind::MissingResult,
823            "no result received for InputManagerServiceSetGamepadLight"
824          )
825        )
826      )
827    }
828  }
829}
830
831//
832// InputManagerServiceSetRuyiControllerStatusArgs
833//
834
835#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
836struct InputManagerServiceSetRuyiControllerStatusArgs {
837  channel: i8,
838  enable_r: bool,
839  enable_g: bool,
840  enable_b: bool,
841  enable_motor1: bool,
842  enable_motor2: bool,
843  shutdown: bool,
844  r_value: i8,
845  g_value: i8,
846  b_value: i8,
847  motor1_value: i8,
848  motor1_time: i8,
849  motor2_value: i8,
850  motor2_time: i8,
851}
852
853impl InputManagerServiceSetRuyiControllerStatusArgs {
854  fn read_from_in_protocol(i_prot: &mut TInputProtocol) -> thrift::Result<InputManagerServiceSetRuyiControllerStatusArgs> {
855    i_prot.read_struct_begin()?;
856    let mut f_1: Option<i8> = None;
857    let mut f_2: Option<bool> = None;
858    let mut f_3: Option<bool> = None;
859    let mut f_4: Option<bool> = None;
860    let mut f_5: Option<bool> = None;
861    let mut f_6: Option<bool> = None;
862    let mut f_7: Option<bool> = None;
863    let mut f_8: Option<i8> = None;
864    let mut f_9: Option<i8> = None;
865    let mut f_10: Option<i8> = None;
866    let mut f_11: Option<i8> = None;
867    let mut f_12: Option<i8> = None;
868    let mut f_13: Option<i8> = None;
869    let mut f_14: Option<i8> = None;
870    loop {
871      let field_ident = i_prot.read_field_begin()?;
872      if field_ident.field_type == TType::Stop {
873        break;
874      }
875      let field_id = field_id(&field_ident)?;
876      match field_id {
877        1 => {
878          let val = i_prot.read_i8()?;
879          f_1 = Some(val);
880        },
881        2 => {
882          let val = i_prot.read_bool()?;
883          f_2 = Some(val);
884        },
885        3 => {
886          let val = i_prot.read_bool()?;
887          f_3 = Some(val);
888        },
889        4 => {
890          let val = i_prot.read_bool()?;
891          f_4 = Some(val);
892        },
893        5 => {
894          let val = i_prot.read_bool()?;
895          f_5 = Some(val);
896        },
897        6 => {
898          let val = i_prot.read_bool()?;
899          f_6 = Some(val);
900        },
901        7 => {
902          let val = i_prot.read_bool()?;
903          f_7 = Some(val);
904        },
905        8 => {
906          let val = i_prot.read_i8()?;
907          f_8 = Some(val);
908        },
909        9 => {
910          let val = i_prot.read_i8()?;
911          f_9 = Some(val);
912        },
913        10 => {
914          let val = i_prot.read_i8()?;
915          f_10 = Some(val);
916        },
917        11 => {
918          let val = i_prot.read_i8()?;
919          f_11 = Some(val);
920        },
921        12 => {
922          let val = i_prot.read_i8()?;
923          f_12 = Some(val);
924        },
925        13 => {
926          let val = i_prot.read_i8()?;
927          f_13 = Some(val);
928        },
929        14 => {
930          let val = i_prot.read_i8()?;
931          f_14 = Some(val);
932        },
933        _ => {
934          i_prot.skip(field_ident.field_type)?;
935        },
936      };
937      i_prot.read_field_end()?;
938    }
939    i_prot.read_struct_end()?;
940    verify_required_field_exists("InputManagerServiceSetRuyiControllerStatusArgs.channel", &f_1)?;
941    verify_required_field_exists("InputManagerServiceSetRuyiControllerStatusArgs.enable_r", &f_2)?;
942    verify_required_field_exists("InputManagerServiceSetRuyiControllerStatusArgs.enable_g", &f_3)?;
943    verify_required_field_exists("InputManagerServiceSetRuyiControllerStatusArgs.enable_b", &f_4)?;
944    verify_required_field_exists("InputManagerServiceSetRuyiControllerStatusArgs.enable_motor1", &f_5)?;
945    verify_required_field_exists("InputManagerServiceSetRuyiControllerStatusArgs.enable_motor2", &f_6)?;
946    verify_required_field_exists("InputManagerServiceSetRuyiControllerStatusArgs.shutdown", &f_7)?;
947    verify_required_field_exists("InputManagerServiceSetRuyiControllerStatusArgs.r_value", &f_8)?;
948    verify_required_field_exists("InputManagerServiceSetRuyiControllerStatusArgs.g_value", &f_9)?;
949    verify_required_field_exists("InputManagerServiceSetRuyiControllerStatusArgs.b_value", &f_10)?;
950    verify_required_field_exists("InputManagerServiceSetRuyiControllerStatusArgs.motor1_value", &f_11)?;
951    verify_required_field_exists("InputManagerServiceSetRuyiControllerStatusArgs.motor1_time", &f_12)?;
952    verify_required_field_exists("InputManagerServiceSetRuyiControllerStatusArgs.motor2_value", &f_13)?;
953    verify_required_field_exists("InputManagerServiceSetRuyiControllerStatusArgs.motor2_time", &f_14)?;
954    let ret = InputManagerServiceSetRuyiControllerStatusArgs {
955      channel: f_1.expect("auto-generated code should have checked for presence of required fields"),
956      enable_r: f_2.expect("auto-generated code should have checked for presence of required fields"),
957      enable_g: f_3.expect("auto-generated code should have checked for presence of required fields"),
958      enable_b: f_4.expect("auto-generated code should have checked for presence of required fields"),
959      enable_motor1: f_5.expect("auto-generated code should have checked for presence of required fields"),
960      enable_motor2: f_6.expect("auto-generated code should have checked for presence of required fields"),
961      shutdown: f_7.expect("auto-generated code should have checked for presence of required fields"),
962      r_value: f_8.expect("auto-generated code should have checked for presence of required fields"),
963      g_value: f_9.expect("auto-generated code should have checked for presence of required fields"),
964      b_value: f_10.expect("auto-generated code should have checked for presence of required fields"),
965      motor1_value: f_11.expect("auto-generated code should have checked for presence of required fields"),
966      motor1_time: f_12.expect("auto-generated code should have checked for presence of required fields"),
967      motor2_value: f_13.expect("auto-generated code should have checked for presence of required fields"),
968      motor2_time: f_14.expect("auto-generated code should have checked for presence of required fields"),
969    };
970    Ok(ret)
971  }
972  fn write_to_out_protocol(&self, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
973    let struct_ident = TStructIdentifier::new("SetRuyiControllerStatus_args");
974    o_prot.write_struct_begin(&struct_ident)?;
975    o_prot.write_field_begin(&TFieldIdentifier::new("channel", TType::I08, 1))?;
976    o_prot.write_i8(self.channel)?;
977    o_prot.write_field_end()?;
978    o_prot.write_field_begin(&TFieldIdentifier::new("enableR", TType::Bool, 2))?;
979    o_prot.write_bool(self.enable_r)?;
980    o_prot.write_field_end()?;
981    o_prot.write_field_begin(&TFieldIdentifier::new("enableG", TType::Bool, 3))?;
982    o_prot.write_bool(self.enable_g)?;
983    o_prot.write_field_end()?;
984    o_prot.write_field_begin(&TFieldIdentifier::new("enableB", TType::Bool, 4))?;
985    o_prot.write_bool(self.enable_b)?;
986    o_prot.write_field_end()?;
987    o_prot.write_field_begin(&TFieldIdentifier::new("enableMotor1", TType::Bool, 5))?;
988    o_prot.write_bool(self.enable_motor1)?;
989    o_prot.write_field_end()?;
990    o_prot.write_field_begin(&TFieldIdentifier::new("enableMotor2", TType::Bool, 6))?;
991    o_prot.write_bool(self.enable_motor2)?;
992    o_prot.write_field_end()?;
993    o_prot.write_field_begin(&TFieldIdentifier::new("shutdown", TType::Bool, 7))?;
994    o_prot.write_bool(self.shutdown)?;
995    o_prot.write_field_end()?;
996    o_prot.write_field_begin(&TFieldIdentifier::new("RValue", TType::I08, 8))?;
997    o_prot.write_i8(self.r_value)?;
998    o_prot.write_field_end()?;
999    o_prot.write_field_begin(&TFieldIdentifier::new("GValue", TType::I08, 9))?;
1000    o_prot.write_i8(self.g_value)?;
1001    o_prot.write_field_end()?;
1002    o_prot.write_field_begin(&TFieldIdentifier::new("BValue", TType::I08, 10))?;
1003    o_prot.write_i8(self.b_value)?;
1004    o_prot.write_field_end()?;
1005    o_prot.write_field_begin(&TFieldIdentifier::new("motor1Value", TType::I08, 11))?;
1006    o_prot.write_i8(self.motor1_value)?;
1007    o_prot.write_field_end()?;
1008    o_prot.write_field_begin(&TFieldIdentifier::new("motor1Time", TType::I08, 12))?;
1009    o_prot.write_i8(self.motor1_time)?;
1010    o_prot.write_field_end()?;
1011    o_prot.write_field_begin(&TFieldIdentifier::new("motor2Value", TType::I08, 13))?;
1012    o_prot.write_i8(self.motor2_value)?;
1013    o_prot.write_field_end()?;
1014    o_prot.write_field_begin(&TFieldIdentifier::new("motor2Time", TType::I08, 14))?;
1015    o_prot.write_i8(self.motor2_time)?;
1016    o_prot.write_field_end()?;
1017    o_prot.write_field_stop()?;
1018    o_prot.write_struct_end()
1019  }
1020}
1021
1022//
1023// InputManagerServiceSetRuyiControllerStatusResult
1024//
1025
1026#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1027struct InputManagerServiceSetRuyiControllerStatusResult {
1028  result_value: Option<bool>,
1029}
1030
1031impl InputManagerServiceSetRuyiControllerStatusResult {
1032  fn read_from_in_protocol(i_prot: &mut TInputProtocol) -> thrift::Result<InputManagerServiceSetRuyiControllerStatusResult> {
1033    i_prot.read_struct_begin()?;
1034    let mut f_0: Option<bool> = None;
1035    loop {
1036      let field_ident = i_prot.read_field_begin()?;
1037      if field_ident.field_type == TType::Stop {
1038        break;
1039      }
1040      let field_id = field_id(&field_ident)?;
1041      match field_id {
1042        0 => {
1043          let val = i_prot.read_bool()?;
1044          f_0 = Some(val);
1045        },
1046        _ => {
1047          i_prot.skip(field_ident.field_type)?;
1048        },
1049      };
1050      i_prot.read_field_end()?;
1051    }
1052    i_prot.read_struct_end()?;
1053    let ret = InputManagerServiceSetRuyiControllerStatusResult {
1054      result_value: f_0,
1055    };
1056    Ok(ret)
1057  }
1058  fn write_to_out_protocol(&self, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
1059    let struct_ident = TStructIdentifier::new("InputManagerServiceSetRuyiControllerStatusResult");
1060    o_prot.write_struct_begin(&struct_ident)?;
1061    if let Some(fld_var) = self.result_value {
1062      o_prot.write_field_begin(&TFieldIdentifier::new("result_value", TType::Bool, 0))?;
1063      o_prot.write_bool(fld_var)?;
1064      o_prot.write_field_end()?;
1065      ()
1066    } else {
1067      ()
1068    }
1069    o_prot.write_field_stop()?;
1070    o_prot.write_struct_end()
1071  }
1072  fn ok_or(self) -> thrift::Result<bool> {
1073    if self.result_value.is_some() {
1074      Ok(self.result_value.unwrap())
1075    } else {
1076      Err(
1077        thrift::Error::Application(
1078          ApplicationError::new(
1079            ApplicationErrorKind::MissingResult,
1080            "no result received for InputManagerServiceSetRuyiControllerStatus"
1081          )
1082        )
1083      )
1084    }
1085  }
1086}
1087