1#![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 localization_service_s_d_k_data_types;
34
35pub trait TLocalizationServiceSyncClient {
40 fn switch_language(&mut self, language: String, load_all_context: bool, remove_old: bool) -> thrift::Result<bool>;
42 fn get_current_language(&mut self) -> thrift::Result<String>;
44 fn switch_context(&mut self, context: String, language: String) -> thrift::Result<bool>;
46 fn hint_context(&mut self) -> thrift::Result<String>;
48 fn get_string(&mut self, key: String, context: String, language: String) -> thrift::Result<String>;
51 fn get_strings(&mut self, filter: String, context: String, language: String) -> thrift::Result<BTreeMap<String, String>>;
53 fn get_file_name(&mut self, filename: String, is_virtual_path: bool, context: String) -> thrift::Result<String>;
57}
58
59pub trait TLocalizationServiceSyncClientMarker {}
60
61pub struct LocalizationServiceSyncClient<IP, OP> where IP: TInputProtocol, OP: TOutputProtocol {
62 _i_prot: IP,
63 _o_prot: OP,
64 _sequence_number: i32,
65}
66
67impl <IP, OP> LocalizationServiceSyncClient<IP, OP> where IP: TInputProtocol, OP: TOutputProtocol {
68 pub fn new(input_protocol: IP, output_protocol: OP) -> LocalizationServiceSyncClient<IP, OP> {
69 LocalizationServiceSyncClient { _i_prot: input_protocol, _o_prot: output_protocol, _sequence_number: 0 }
70 }
71}
72
73impl <IP, OP> TThriftClient for LocalizationServiceSyncClient<IP, OP> where IP: TInputProtocol, OP: TOutputProtocol {
74 fn i_prot_mut(&mut self) -> &mut TInputProtocol { &mut self._i_prot }
75 fn o_prot_mut(&mut self) -> &mut TOutputProtocol { &mut self._o_prot }
76 fn sequence_number(&self) -> i32 { self._sequence_number }
77 fn increment_sequence_number(&mut self) -> i32 { self._sequence_number += 1; self._sequence_number }
78}
79
80impl <IP, OP> TLocalizationServiceSyncClientMarker for LocalizationServiceSyncClient<IP, OP> where IP: TInputProtocol, OP: TOutputProtocol {}
81
82impl <C: TThriftClient + TLocalizationServiceSyncClientMarker> TLocalizationServiceSyncClient for C {
83 fn switch_language(&mut self, language: String, load_all_context: bool, remove_old: bool) -> thrift::Result<bool> {
84 (
85 {
86 self.increment_sequence_number();
87 let message_ident = TMessageIdentifier::new("SwitchLanguage", TMessageType::Call, self.sequence_number());
88 let call_args = LocalizationServiceSwitchLanguageArgs { language: language, load_all_context: load_all_context, remove_old: remove_old };
89 self.o_prot_mut().write_message_begin(&message_ident)?;
90 call_args.write_to_out_protocol(self.o_prot_mut())?;
91 self.o_prot_mut().write_message_end()?;
92 self.o_prot_mut().flush()
93 }
94 )?;
95 {
96 let message_ident = self.i_prot_mut().read_message_begin()?;
97 verify_expected_sequence_number(self.sequence_number(), message_ident.sequence_number)?;
98 verify_expected_service_call("SwitchLanguage", &message_ident.name)?;
99 if message_ident.message_type == TMessageType::Exception {
100 let remote_error = thrift::Error::read_application_error_from_in_protocol(self.i_prot_mut())?;
101 self.i_prot_mut().read_message_end()?;
102 return Err(thrift::Error::Application(remote_error))
103 }
104 verify_expected_message_type(TMessageType::Reply, message_ident.message_type)?;
105 let result = LocalizationServiceSwitchLanguageResult::read_from_in_protocol(self.i_prot_mut())?;
106 self.i_prot_mut().read_message_end()?;
107 result.ok_or()
108 }
109 }
110 fn get_current_language(&mut self) -> thrift::Result<String> {
111 (
112 {
113 self.increment_sequence_number();
114 let message_ident = TMessageIdentifier::new("GetCurrentLanguage", TMessageType::Call, self.sequence_number());
115 let call_args = LocalizationServiceGetCurrentLanguageArgs { };
116 self.o_prot_mut().write_message_begin(&message_ident)?;
117 call_args.write_to_out_protocol(self.o_prot_mut())?;
118 self.o_prot_mut().write_message_end()?;
119 self.o_prot_mut().flush()
120 }
121 )?;
122 {
123 let message_ident = self.i_prot_mut().read_message_begin()?;
124 verify_expected_sequence_number(self.sequence_number(), message_ident.sequence_number)?;
125 verify_expected_service_call("GetCurrentLanguage", &message_ident.name)?;
126 if message_ident.message_type == TMessageType::Exception {
127 let remote_error = thrift::Error::read_application_error_from_in_protocol(self.i_prot_mut())?;
128 self.i_prot_mut().read_message_end()?;
129 return Err(thrift::Error::Application(remote_error))
130 }
131 verify_expected_message_type(TMessageType::Reply, message_ident.message_type)?;
132 let result = LocalizationServiceGetCurrentLanguageResult::read_from_in_protocol(self.i_prot_mut())?;
133 self.i_prot_mut().read_message_end()?;
134 result.ok_or()
135 }
136 }
137 fn switch_context(&mut self, context: String, language: String) -> thrift::Result<bool> {
138 (
139 {
140 self.increment_sequence_number();
141 let message_ident = TMessageIdentifier::new("SwitchContext", TMessageType::Call, self.sequence_number());
142 let call_args = LocalizationServiceSwitchContextArgs { context: context, language: language };
143 self.o_prot_mut().write_message_begin(&message_ident)?;
144 call_args.write_to_out_protocol(self.o_prot_mut())?;
145 self.o_prot_mut().write_message_end()?;
146 self.o_prot_mut().flush()
147 }
148 )?;
149 {
150 let message_ident = self.i_prot_mut().read_message_begin()?;
151 verify_expected_sequence_number(self.sequence_number(), message_ident.sequence_number)?;
152 verify_expected_service_call("SwitchContext", &message_ident.name)?;
153 if message_ident.message_type == TMessageType::Exception {
154 let remote_error = thrift::Error::read_application_error_from_in_protocol(self.i_prot_mut())?;
155 self.i_prot_mut().read_message_end()?;
156 return Err(thrift::Error::Application(remote_error))
157 }
158 verify_expected_message_type(TMessageType::Reply, message_ident.message_type)?;
159 let result = LocalizationServiceSwitchContextResult::read_from_in_protocol(self.i_prot_mut())?;
160 self.i_prot_mut().read_message_end()?;
161 result.ok_or()
162 }
163 }
164 fn hint_context(&mut self) -> thrift::Result<String> {
165 (
166 {
167 self.increment_sequence_number();
168 let message_ident = TMessageIdentifier::new("HintContext", TMessageType::Call, self.sequence_number());
169 let call_args = LocalizationServiceHintContextArgs { };
170 self.o_prot_mut().write_message_begin(&message_ident)?;
171 call_args.write_to_out_protocol(self.o_prot_mut())?;
172 self.o_prot_mut().write_message_end()?;
173 self.o_prot_mut().flush()
174 }
175 )?;
176 {
177 let message_ident = self.i_prot_mut().read_message_begin()?;
178 verify_expected_sequence_number(self.sequence_number(), message_ident.sequence_number)?;
179 verify_expected_service_call("HintContext", &message_ident.name)?;
180 if message_ident.message_type == TMessageType::Exception {
181 let remote_error = thrift::Error::read_application_error_from_in_protocol(self.i_prot_mut())?;
182 self.i_prot_mut().read_message_end()?;
183 return Err(thrift::Error::Application(remote_error))
184 }
185 verify_expected_message_type(TMessageType::Reply, message_ident.message_type)?;
186 let result = LocalizationServiceHintContextResult::read_from_in_protocol(self.i_prot_mut())?;
187 self.i_prot_mut().read_message_end()?;
188 result.ok_or()
189 }
190 }
191 fn get_string(&mut self, key: String, context: String, language: String) -> thrift::Result<String> {
192 (
193 {
194 self.increment_sequence_number();
195 let message_ident = TMessageIdentifier::new("GetString", TMessageType::Call, self.sequence_number());
196 let call_args = LocalizationServiceGetStringArgs { key: key, context: context, language: language };
197 self.o_prot_mut().write_message_begin(&message_ident)?;
198 call_args.write_to_out_protocol(self.o_prot_mut())?;
199 self.o_prot_mut().write_message_end()?;
200 self.o_prot_mut().flush()
201 }
202 )?;
203 {
204 let message_ident = self.i_prot_mut().read_message_begin()?;
205 verify_expected_sequence_number(self.sequence_number(), message_ident.sequence_number)?;
206 verify_expected_service_call("GetString", &message_ident.name)?;
207 if message_ident.message_type == TMessageType::Exception {
208 let remote_error = thrift::Error::read_application_error_from_in_protocol(self.i_prot_mut())?;
209 self.i_prot_mut().read_message_end()?;
210 return Err(thrift::Error::Application(remote_error))
211 }
212 verify_expected_message_type(TMessageType::Reply, message_ident.message_type)?;
213 let result = LocalizationServiceGetStringResult::read_from_in_protocol(self.i_prot_mut())?;
214 self.i_prot_mut().read_message_end()?;
215 result.ok_or()
216 }
217 }
218 fn get_strings(&mut self, filter: String, context: String, language: String) -> thrift::Result<BTreeMap<String, String>> {
219 (
220 {
221 self.increment_sequence_number();
222 let message_ident = TMessageIdentifier::new("GetStrings", TMessageType::Call, self.sequence_number());
223 let call_args = LocalizationServiceGetStringsArgs { filter: filter, context: context, language: language };
224 self.o_prot_mut().write_message_begin(&message_ident)?;
225 call_args.write_to_out_protocol(self.o_prot_mut())?;
226 self.o_prot_mut().write_message_end()?;
227 self.o_prot_mut().flush()
228 }
229 )?;
230 {
231 let message_ident = self.i_prot_mut().read_message_begin()?;
232 verify_expected_sequence_number(self.sequence_number(), message_ident.sequence_number)?;
233 verify_expected_service_call("GetStrings", &message_ident.name)?;
234 if message_ident.message_type == TMessageType::Exception {
235 let remote_error = thrift::Error::read_application_error_from_in_protocol(self.i_prot_mut())?;
236 self.i_prot_mut().read_message_end()?;
237 return Err(thrift::Error::Application(remote_error))
238 }
239 verify_expected_message_type(TMessageType::Reply, message_ident.message_type)?;
240 let result = LocalizationServiceGetStringsResult::read_from_in_protocol(self.i_prot_mut())?;
241 self.i_prot_mut().read_message_end()?;
242 result.ok_or()
243 }
244 }
245 fn get_file_name(&mut self, filename: String, is_virtual_path: bool, context: String) -> thrift::Result<String> {
246 (
247 {
248 self.increment_sequence_number();
249 let message_ident = TMessageIdentifier::new("GetFileName", TMessageType::Call, self.sequence_number());
250 let call_args = LocalizationServiceGetFileNameArgs { filename: filename, is_virtual_path: is_virtual_path, context: context };
251 self.o_prot_mut().write_message_begin(&message_ident)?;
252 call_args.write_to_out_protocol(self.o_prot_mut())?;
253 self.o_prot_mut().write_message_end()?;
254 self.o_prot_mut().flush()
255 }
256 )?;
257 {
258 let message_ident = self.i_prot_mut().read_message_begin()?;
259 verify_expected_sequence_number(self.sequence_number(), message_ident.sequence_number)?;
260 verify_expected_service_call("GetFileName", &message_ident.name)?;
261 if message_ident.message_type == TMessageType::Exception {
262 let remote_error = thrift::Error::read_application_error_from_in_protocol(self.i_prot_mut())?;
263 self.i_prot_mut().read_message_end()?;
264 return Err(thrift::Error::Application(remote_error))
265 }
266 verify_expected_message_type(TMessageType::Reply, message_ident.message_type)?;
267 let result = LocalizationServiceGetFileNameResult::read_from_in_protocol(self.i_prot_mut())?;
268 self.i_prot_mut().read_message_end()?;
269 result.ok_or()
270 }
271 }
272}
273
274pub trait LocalizationServiceSyncHandler {
279 fn handle_switch_language(&self, language: String, load_all_context: bool, remove_old: bool) -> thrift::Result<bool>;
281 fn handle_get_current_language(&self) -> thrift::Result<String>;
283 fn handle_switch_context(&self, context: String, language: String) -> thrift::Result<bool>;
285 fn handle_hint_context(&self) -> thrift::Result<String>;
287 fn handle_get_string(&self, key: String, context: String, language: String) -> thrift::Result<String>;
290 fn handle_get_strings(&self, filter: String, context: String, language: String) -> thrift::Result<BTreeMap<String, String>>;
292 fn handle_get_file_name(&self, filename: String, is_virtual_path: bool, context: String) -> thrift::Result<String>;
296}
297
298pub struct LocalizationServiceSyncProcessor<H: LocalizationServiceSyncHandler> {
299 handler: H,
300}
301
302impl <H: LocalizationServiceSyncHandler> LocalizationServiceSyncProcessor<H> {
303 pub fn new(handler: H) -> LocalizationServiceSyncProcessor<H> {
304 LocalizationServiceSyncProcessor {
305 handler,
306 }
307 }
308 fn process_switch_language(&self, incoming_sequence_number: i32, i_prot: &mut TInputProtocol, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
309 TLocalizationServiceProcessFunctions::process_switch_language(&self.handler, incoming_sequence_number, i_prot, o_prot)
310 }
311 fn process_get_current_language(&self, incoming_sequence_number: i32, i_prot: &mut TInputProtocol, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
312 TLocalizationServiceProcessFunctions::process_get_current_language(&self.handler, incoming_sequence_number, i_prot, o_prot)
313 }
314 fn process_switch_context(&self, incoming_sequence_number: i32, i_prot: &mut TInputProtocol, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
315 TLocalizationServiceProcessFunctions::process_switch_context(&self.handler, incoming_sequence_number, i_prot, o_prot)
316 }
317 fn process_hint_context(&self, incoming_sequence_number: i32, i_prot: &mut TInputProtocol, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
318 TLocalizationServiceProcessFunctions::process_hint_context(&self.handler, incoming_sequence_number, i_prot, o_prot)
319 }
320 fn process_get_string(&self, incoming_sequence_number: i32, i_prot: &mut TInputProtocol, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
321 TLocalizationServiceProcessFunctions::process_get_string(&self.handler, incoming_sequence_number, i_prot, o_prot)
322 }
323 fn process_get_strings(&self, incoming_sequence_number: i32, i_prot: &mut TInputProtocol, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
324 TLocalizationServiceProcessFunctions::process_get_strings(&self.handler, incoming_sequence_number, i_prot, o_prot)
325 }
326 fn process_get_file_name(&self, incoming_sequence_number: i32, i_prot: &mut TInputProtocol, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
327 TLocalizationServiceProcessFunctions::process_get_file_name(&self.handler, incoming_sequence_number, i_prot, o_prot)
328 }
329}
330
331pub struct TLocalizationServiceProcessFunctions;
332
333impl TLocalizationServiceProcessFunctions {
334 pub fn process_switch_language<H: LocalizationServiceSyncHandler>(handler: &H, incoming_sequence_number: i32, i_prot: &mut TInputProtocol, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
335 let args = LocalizationServiceSwitchLanguageArgs::read_from_in_protocol(i_prot)?;
336 match handler.handle_switch_language(args.language, args.load_all_context, args.remove_old) {
337 Ok(handler_return) => {
338 let message_ident = TMessageIdentifier::new("SwitchLanguage", TMessageType::Reply, incoming_sequence_number);
339 o_prot.write_message_begin(&message_ident)?;
340 let ret = LocalizationServiceSwitchLanguageResult { result_value: Some(handler_return) };
341 ret.write_to_out_protocol(o_prot)?;
342 o_prot.write_message_end()?;
343 o_prot.flush()
344 },
345 Err(e) => {
346 match e {
347 thrift::Error::Application(app_err) => {
348 let message_ident = TMessageIdentifier::new("SwitchLanguage", TMessageType::Exception, incoming_sequence_number);
349 o_prot.write_message_begin(&message_ident)?;
350 thrift::Error::write_application_error_to_out_protocol(&app_err, o_prot)?;
351 o_prot.write_message_end()?;
352 o_prot.flush()
353 },
354 _ => {
355 let ret_err = {
356 ApplicationError::new(
357 ApplicationErrorKind::Unknown,
358 e.description()
359 )
360 };
361 let message_ident = TMessageIdentifier::new("SwitchLanguage", TMessageType::Exception, incoming_sequence_number);
362 o_prot.write_message_begin(&message_ident)?;
363 thrift::Error::write_application_error_to_out_protocol(&ret_err, o_prot)?;
364 o_prot.write_message_end()?;
365 o_prot.flush()
366 },
367 }
368 },
369 }
370 }
371 pub fn process_get_current_language<H: LocalizationServiceSyncHandler>(handler: &H, incoming_sequence_number: i32, i_prot: &mut TInputProtocol, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
372 let _ = LocalizationServiceGetCurrentLanguageArgs::read_from_in_protocol(i_prot)?;
373 match handler.handle_get_current_language() {
374 Ok(handler_return) => {
375 let message_ident = TMessageIdentifier::new("GetCurrentLanguage", TMessageType::Reply, incoming_sequence_number);
376 o_prot.write_message_begin(&message_ident)?;
377 let ret = LocalizationServiceGetCurrentLanguageResult { result_value: Some(handler_return) };
378 ret.write_to_out_protocol(o_prot)?;
379 o_prot.write_message_end()?;
380 o_prot.flush()
381 },
382 Err(e) => {
383 match e {
384 thrift::Error::Application(app_err) => {
385 let message_ident = TMessageIdentifier::new("GetCurrentLanguage", TMessageType::Exception, incoming_sequence_number);
386 o_prot.write_message_begin(&message_ident)?;
387 thrift::Error::write_application_error_to_out_protocol(&app_err, o_prot)?;
388 o_prot.write_message_end()?;
389 o_prot.flush()
390 },
391 _ => {
392 let ret_err = {
393 ApplicationError::new(
394 ApplicationErrorKind::Unknown,
395 e.description()
396 )
397 };
398 let message_ident = TMessageIdentifier::new("GetCurrentLanguage", TMessageType::Exception, incoming_sequence_number);
399 o_prot.write_message_begin(&message_ident)?;
400 thrift::Error::write_application_error_to_out_protocol(&ret_err, o_prot)?;
401 o_prot.write_message_end()?;
402 o_prot.flush()
403 },
404 }
405 },
406 }
407 }
408 pub fn process_switch_context<H: LocalizationServiceSyncHandler>(handler: &H, incoming_sequence_number: i32, i_prot: &mut TInputProtocol, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
409 let args = LocalizationServiceSwitchContextArgs::read_from_in_protocol(i_prot)?;
410 match handler.handle_switch_context(args.context, args.language) {
411 Ok(handler_return) => {
412 let message_ident = TMessageIdentifier::new("SwitchContext", TMessageType::Reply, incoming_sequence_number);
413 o_prot.write_message_begin(&message_ident)?;
414 let ret = LocalizationServiceSwitchContextResult { result_value: Some(handler_return) };
415 ret.write_to_out_protocol(o_prot)?;
416 o_prot.write_message_end()?;
417 o_prot.flush()
418 },
419 Err(e) => {
420 match e {
421 thrift::Error::Application(app_err) => {
422 let message_ident = TMessageIdentifier::new("SwitchContext", TMessageType::Exception, incoming_sequence_number);
423 o_prot.write_message_begin(&message_ident)?;
424 thrift::Error::write_application_error_to_out_protocol(&app_err, o_prot)?;
425 o_prot.write_message_end()?;
426 o_prot.flush()
427 },
428 _ => {
429 let ret_err = {
430 ApplicationError::new(
431 ApplicationErrorKind::Unknown,
432 e.description()
433 )
434 };
435 let message_ident = TMessageIdentifier::new("SwitchContext", TMessageType::Exception, incoming_sequence_number);
436 o_prot.write_message_begin(&message_ident)?;
437 thrift::Error::write_application_error_to_out_protocol(&ret_err, o_prot)?;
438 o_prot.write_message_end()?;
439 o_prot.flush()
440 },
441 }
442 },
443 }
444 }
445 pub fn process_hint_context<H: LocalizationServiceSyncHandler>(handler: &H, incoming_sequence_number: i32, i_prot: &mut TInputProtocol, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
446 let _ = LocalizationServiceHintContextArgs::read_from_in_protocol(i_prot)?;
447 match handler.handle_hint_context() {
448 Ok(handler_return) => {
449 let message_ident = TMessageIdentifier::new("HintContext", TMessageType::Reply, incoming_sequence_number);
450 o_prot.write_message_begin(&message_ident)?;
451 let ret = LocalizationServiceHintContextResult { result_value: Some(handler_return) };
452 ret.write_to_out_protocol(o_prot)?;
453 o_prot.write_message_end()?;
454 o_prot.flush()
455 },
456 Err(e) => {
457 match e {
458 thrift::Error::Application(app_err) => {
459 let message_ident = TMessageIdentifier::new("HintContext", TMessageType::Exception, incoming_sequence_number);
460 o_prot.write_message_begin(&message_ident)?;
461 thrift::Error::write_application_error_to_out_protocol(&app_err, o_prot)?;
462 o_prot.write_message_end()?;
463 o_prot.flush()
464 },
465 _ => {
466 let ret_err = {
467 ApplicationError::new(
468 ApplicationErrorKind::Unknown,
469 e.description()
470 )
471 };
472 let message_ident = TMessageIdentifier::new("HintContext", TMessageType::Exception, incoming_sequence_number);
473 o_prot.write_message_begin(&message_ident)?;
474 thrift::Error::write_application_error_to_out_protocol(&ret_err, o_prot)?;
475 o_prot.write_message_end()?;
476 o_prot.flush()
477 },
478 }
479 },
480 }
481 }
482 pub fn process_get_string<H: LocalizationServiceSyncHandler>(handler: &H, incoming_sequence_number: i32, i_prot: &mut TInputProtocol, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
483 let args = LocalizationServiceGetStringArgs::read_from_in_protocol(i_prot)?;
484 match handler.handle_get_string(args.key, args.context, args.language) {
485 Ok(handler_return) => {
486 let message_ident = TMessageIdentifier::new("GetString", TMessageType::Reply, incoming_sequence_number);
487 o_prot.write_message_begin(&message_ident)?;
488 let ret = LocalizationServiceGetStringResult { result_value: Some(handler_return) };
489 ret.write_to_out_protocol(o_prot)?;
490 o_prot.write_message_end()?;
491 o_prot.flush()
492 },
493 Err(e) => {
494 match e {
495 thrift::Error::Application(app_err) => {
496 let message_ident = TMessageIdentifier::new("GetString", TMessageType::Exception, incoming_sequence_number);
497 o_prot.write_message_begin(&message_ident)?;
498 thrift::Error::write_application_error_to_out_protocol(&app_err, o_prot)?;
499 o_prot.write_message_end()?;
500 o_prot.flush()
501 },
502 _ => {
503 let ret_err = {
504 ApplicationError::new(
505 ApplicationErrorKind::Unknown,
506 e.description()
507 )
508 };
509 let message_ident = TMessageIdentifier::new("GetString", TMessageType::Exception, incoming_sequence_number);
510 o_prot.write_message_begin(&message_ident)?;
511 thrift::Error::write_application_error_to_out_protocol(&ret_err, o_prot)?;
512 o_prot.write_message_end()?;
513 o_prot.flush()
514 },
515 }
516 },
517 }
518 }
519 pub fn process_get_strings<H: LocalizationServiceSyncHandler>(handler: &H, incoming_sequence_number: i32, i_prot: &mut TInputProtocol, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
520 let args = LocalizationServiceGetStringsArgs::read_from_in_protocol(i_prot)?;
521 match handler.handle_get_strings(args.filter, args.context, args.language) {
522 Ok(handler_return) => {
523 let message_ident = TMessageIdentifier::new("GetStrings", TMessageType::Reply, incoming_sequence_number);
524 o_prot.write_message_begin(&message_ident)?;
525 let ret = LocalizationServiceGetStringsResult { result_value: Some(handler_return) };
526 ret.write_to_out_protocol(o_prot)?;
527 o_prot.write_message_end()?;
528 o_prot.flush()
529 },
530 Err(e) => {
531 match e {
532 thrift::Error::Application(app_err) => {
533 let message_ident = TMessageIdentifier::new("GetStrings", TMessageType::Exception, incoming_sequence_number);
534 o_prot.write_message_begin(&message_ident)?;
535 thrift::Error::write_application_error_to_out_protocol(&app_err, o_prot)?;
536 o_prot.write_message_end()?;
537 o_prot.flush()
538 },
539 _ => {
540 let ret_err = {
541 ApplicationError::new(
542 ApplicationErrorKind::Unknown,
543 e.description()
544 )
545 };
546 let message_ident = TMessageIdentifier::new("GetStrings", TMessageType::Exception, incoming_sequence_number);
547 o_prot.write_message_begin(&message_ident)?;
548 thrift::Error::write_application_error_to_out_protocol(&ret_err, o_prot)?;
549 o_prot.write_message_end()?;
550 o_prot.flush()
551 },
552 }
553 },
554 }
555 }
556 pub fn process_get_file_name<H: LocalizationServiceSyncHandler>(handler: &H, incoming_sequence_number: i32, i_prot: &mut TInputProtocol, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
557 let args = LocalizationServiceGetFileNameArgs::read_from_in_protocol(i_prot)?;
558 match handler.handle_get_file_name(args.filename, args.is_virtual_path, args.context) {
559 Ok(handler_return) => {
560 let message_ident = TMessageIdentifier::new("GetFileName", TMessageType::Reply, incoming_sequence_number);
561 o_prot.write_message_begin(&message_ident)?;
562 let ret = LocalizationServiceGetFileNameResult { result_value: Some(handler_return) };
563 ret.write_to_out_protocol(o_prot)?;
564 o_prot.write_message_end()?;
565 o_prot.flush()
566 },
567 Err(e) => {
568 match e {
569 thrift::Error::Application(app_err) => {
570 let message_ident = TMessageIdentifier::new("GetFileName", TMessageType::Exception, incoming_sequence_number);
571 o_prot.write_message_begin(&message_ident)?;
572 thrift::Error::write_application_error_to_out_protocol(&app_err, o_prot)?;
573 o_prot.write_message_end()?;
574 o_prot.flush()
575 },
576 _ => {
577 let ret_err = {
578 ApplicationError::new(
579 ApplicationErrorKind::Unknown,
580 e.description()
581 )
582 };
583 let message_ident = TMessageIdentifier::new("GetFileName", TMessageType::Exception, incoming_sequence_number);
584 o_prot.write_message_begin(&message_ident)?;
585 thrift::Error::write_application_error_to_out_protocol(&ret_err, o_prot)?;
586 o_prot.write_message_end()?;
587 o_prot.flush()
588 },
589 }
590 },
591 }
592 }
593}
594
595impl <H: LocalizationServiceSyncHandler> TProcessor for LocalizationServiceSyncProcessor<H> {
596 fn process(&self, i_prot: &mut TInputProtocol, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
597 let message_ident = i_prot.read_message_begin()?;
598 let res = match &*message_ident.name {
599 "SwitchLanguage" => {
600 self.process_switch_language(message_ident.sequence_number, i_prot, o_prot)
601 },
602 "GetCurrentLanguage" => {
603 self.process_get_current_language(message_ident.sequence_number, i_prot, o_prot)
604 },
605 "SwitchContext" => {
606 self.process_switch_context(message_ident.sequence_number, i_prot, o_prot)
607 },
608 "HintContext" => {
609 self.process_hint_context(message_ident.sequence_number, i_prot, o_prot)
610 },
611 "GetString" => {
612 self.process_get_string(message_ident.sequence_number, i_prot, o_prot)
613 },
614 "GetStrings" => {
615 self.process_get_strings(message_ident.sequence_number, i_prot, o_prot)
616 },
617 "GetFileName" => {
618 self.process_get_file_name(message_ident.sequence_number, i_prot, o_prot)
619 },
620 method => {
621 Err(
622 thrift::Error::Application(
623 ApplicationError::new(
624 ApplicationErrorKind::UnknownMethod,
625 format!("unknown method {}", method)
626 )
627 )
628 )
629 },
630 };
631 thrift::server::handle_process_result(&message_ident, res, o_prot)
632 }
633}
634
635#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
640struct LocalizationServiceSwitchLanguageArgs {
641 language: String,
643 load_all_context: bool,
645 remove_old: bool,
647}
648
649impl LocalizationServiceSwitchLanguageArgs {
650 fn read_from_in_protocol(i_prot: &mut TInputProtocol) -> thrift::Result<LocalizationServiceSwitchLanguageArgs> {
651 i_prot.read_struct_begin()?;
652 let mut f_1: Option<String> = None;
653 let mut f_2: Option<bool> = None;
654 let mut f_3: Option<bool> = None;
655 loop {
656 let field_ident = i_prot.read_field_begin()?;
657 if field_ident.field_type == TType::Stop {
658 break;
659 }
660 let field_id = field_id(&field_ident)?;
661 match field_id {
662 1 => {
663 let val = i_prot.read_string()?;
664 f_1 = Some(val);
665 },
666 2 => {
667 let val = i_prot.read_bool()?;
668 f_2 = Some(val);
669 },
670 3 => {
671 let val = i_prot.read_bool()?;
672 f_3 = Some(val);
673 },
674 _ => {
675 i_prot.skip(field_ident.field_type)?;
676 },
677 };
678 i_prot.read_field_end()?;
679 }
680 i_prot.read_struct_end()?;
681 verify_required_field_exists("LocalizationServiceSwitchLanguageArgs.language", &f_1)?;
682 verify_required_field_exists("LocalizationServiceSwitchLanguageArgs.load_all_context", &f_2)?;
683 verify_required_field_exists("LocalizationServiceSwitchLanguageArgs.remove_old", &f_3)?;
684 let ret = LocalizationServiceSwitchLanguageArgs {
685 language: f_1.expect("auto-generated code should have checked for presence of required fields"),
686 load_all_context: f_2.expect("auto-generated code should have checked for presence of required fields"),
687 remove_old: f_3.expect("auto-generated code should have checked for presence of required fields"),
688 };
689 Ok(ret)
690 }
691 fn write_to_out_protocol(&self, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
692 let struct_ident = TStructIdentifier::new("SwitchLanguage_args");
693 o_prot.write_struct_begin(&struct_ident)?;
694 o_prot.write_field_begin(&TFieldIdentifier::new("language", TType::String, 1))?;
695 o_prot.write_string(&self.language)?;
696 o_prot.write_field_end()?;
697 o_prot.write_field_begin(&TFieldIdentifier::new("loadAllContext", TType::Bool, 2))?;
698 o_prot.write_bool(self.load_all_context)?;
699 o_prot.write_field_end()?;
700 o_prot.write_field_begin(&TFieldIdentifier::new("removeOld", TType::Bool, 3))?;
701 o_prot.write_bool(self.remove_old)?;
702 o_prot.write_field_end()?;
703 o_prot.write_field_stop()?;
704 o_prot.write_struct_end()
705 }
706}
707
708#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
713struct LocalizationServiceSwitchLanguageResult {
714 result_value: Option<bool>,
715}
716
717impl LocalizationServiceSwitchLanguageResult {
718 fn read_from_in_protocol(i_prot: &mut TInputProtocol) -> thrift::Result<LocalizationServiceSwitchLanguageResult> {
719 i_prot.read_struct_begin()?;
720 let mut f_0: Option<bool> = None;
721 loop {
722 let field_ident = i_prot.read_field_begin()?;
723 if field_ident.field_type == TType::Stop {
724 break;
725 }
726 let field_id = field_id(&field_ident)?;
727 match field_id {
728 0 => {
729 let val = i_prot.read_bool()?;
730 f_0 = Some(val);
731 },
732 _ => {
733 i_prot.skip(field_ident.field_type)?;
734 },
735 };
736 i_prot.read_field_end()?;
737 }
738 i_prot.read_struct_end()?;
739 let ret = LocalizationServiceSwitchLanguageResult {
740 result_value: f_0,
741 };
742 Ok(ret)
743 }
744 fn write_to_out_protocol(&self, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
745 let struct_ident = TStructIdentifier::new("LocalizationServiceSwitchLanguageResult");
746 o_prot.write_struct_begin(&struct_ident)?;
747 if let Some(fld_var) = self.result_value {
748 o_prot.write_field_begin(&TFieldIdentifier::new("result_value", TType::Bool, 0))?;
749 o_prot.write_bool(fld_var)?;
750 o_prot.write_field_end()?;
751 ()
752 } else {
753 ()
754 }
755 o_prot.write_field_stop()?;
756 o_prot.write_struct_end()
757 }
758 fn ok_or(self) -> thrift::Result<bool> {
759 if self.result_value.is_some() {
760 Ok(self.result_value.unwrap())
761 } else {
762 Err(
763 thrift::Error::Application(
764 ApplicationError::new(
765 ApplicationErrorKind::MissingResult,
766 "no result received for LocalizationServiceSwitchLanguage"
767 )
768 )
769 )
770 }
771 }
772}
773
774#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
779struct LocalizationServiceGetCurrentLanguageArgs {
780}
781
782impl LocalizationServiceGetCurrentLanguageArgs {
783 fn read_from_in_protocol(i_prot: &mut TInputProtocol) -> thrift::Result<LocalizationServiceGetCurrentLanguageArgs> {
784 i_prot.read_struct_begin()?;
785 loop {
786 let field_ident = i_prot.read_field_begin()?;
787 if field_ident.field_type == TType::Stop {
788 break;
789 }
790 let field_id = field_id(&field_ident)?;
791 match field_id {
792 _ => {
793 i_prot.skip(field_ident.field_type)?;
794 },
795 };
796 i_prot.read_field_end()?;
797 }
798 i_prot.read_struct_end()?;
799 let ret = LocalizationServiceGetCurrentLanguageArgs {};
800 Ok(ret)
801 }
802 fn write_to_out_protocol(&self, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
803 let struct_ident = TStructIdentifier::new("GetCurrentLanguage_args");
804 o_prot.write_struct_begin(&struct_ident)?;
805 o_prot.write_field_stop()?;
806 o_prot.write_struct_end()
807 }
808}
809
810#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
815struct LocalizationServiceGetCurrentLanguageResult {
816 result_value: Option<String>,
817}
818
819impl LocalizationServiceGetCurrentLanguageResult {
820 fn read_from_in_protocol(i_prot: &mut TInputProtocol) -> thrift::Result<LocalizationServiceGetCurrentLanguageResult> {
821 i_prot.read_struct_begin()?;
822 let mut f_0: Option<String> = None;
823 loop {
824 let field_ident = i_prot.read_field_begin()?;
825 if field_ident.field_type == TType::Stop {
826 break;
827 }
828 let field_id = field_id(&field_ident)?;
829 match field_id {
830 0 => {
831 let val = i_prot.read_string()?;
832 f_0 = Some(val);
833 },
834 _ => {
835 i_prot.skip(field_ident.field_type)?;
836 },
837 };
838 i_prot.read_field_end()?;
839 }
840 i_prot.read_struct_end()?;
841 let ret = LocalizationServiceGetCurrentLanguageResult {
842 result_value: f_0,
843 };
844 Ok(ret)
845 }
846 fn write_to_out_protocol(&self, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
847 let struct_ident = TStructIdentifier::new("LocalizationServiceGetCurrentLanguageResult");
848 o_prot.write_struct_begin(&struct_ident)?;
849 if let Some(ref fld_var) = self.result_value {
850 o_prot.write_field_begin(&TFieldIdentifier::new("result_value", TType::String, 0))?;
851 o_prot.write_string(fld_var)?;
852 o_prot.write_field_end()?;
853 ()
854 } else {
855 ()
856 }
857 o_prot.write_field_stop()?;
858 o_prot.write_struct_end()
859 }
860 fn ok_or(self) -> thrift::Result<String> {
861 if self.result_value.is_some() {
862 Ok(self.result_value.unwrap())
863 } else {
864 Err(
865 thrift::Error::Application(
866 ApplicationError::new(
867 ApplicationErrorKind::MissingResult,
868 "no result received for LocalizationServiceGetCurrentLanguage"
869 )
870 )
871 )
872 }
873 }
874}
875
876#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
881struct LocalizationServiceSwitchContextArgs {
882 context: String,
884 language: String,
886}
887
888impl LocalizationServiceSwitchContextArgs {
889 fn read_from_in_protocol(i_prot: &mut TInputProtocol) -> thrift::Result<LocalizationServiceSwitchContextArgs> {
890 i_prot.read_struct_begin()?;
891 let mut f_1: Option<String> = None;
892 let mut f_2: Option<String> = None;
893 loop {
894 let field_ident = i_prot.read_field_begin()?;
895 if field_ident.field_type == TType::Stop {
896 break;
897 }
898 let field_id = field_id(&field_ident)?;
899 match field_id {
900 1 => {
901 let val = i_prot.read_string()?;
902 f_1 = Some(val);
903 },
904 2 => {
905 let val = i_prot.read_string()?;
906 f_2 = Some(val);
907 },
908 _ => {
909 i_prot.skip(field_ident.field_type)?;
910 },
911 };
912 i_prot.read_field_end()?;
913 }
914 i_prot.read_struct_end()?;
915 verify_required_field_exists("LocalizationServiceSwitchContextArgs.context", &f_1)?;
916 verify_required_field_exists("LocalizationServiceSwitchContextArgs.language", &f_2)?;
917 let ret = LocalizationServiceSwitchContextArgs {
918 context: f_1.expect("auto-generated code should have checked for presence of required fields"),
919 language: f_2.expect("auto-generated code should have checked for presence of required fields"),
920 };
921 Ok(ret)
922 }
923 fn write_to_out_protocol(&self, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
924 let struct_ident = TStructIdentifier::new("SwitchContext_args");
925 o_prot.write_struct_begin(&struct_ident)?;
926 o_prot.write_field_begin(&TFieldIdentifier::new("context", TType::String, 1))?;
927 o_prot.write_string(&self.context)?;
928 o_prot.write_field_end()?;
929 o_prot.write_field_begin(&TFieldIdentifier::new("language", TType::String, 2))?;
930 o_prot.write_string(&self.language)?;
931 o_prot.write_field_end()?;
932 o_prot.write_field_stop()?;
933 o_prot.write_struct_end()
934 }
935}
936
937#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
942struct LocalizationServiceSwitchContextResult {
943 result_value: Option<bool>,
944}
945
946impl LocalizationServiceSwitchContextResult {
947 fn read_from_in_protocol(i_prot: &mut TInputProtocol) -> thrift::Result<LocalizationServiceSwitchContextResult> {
948 i_prot.read_struct_begin()?;
949 let mut f_0: Option<bool> = None;
950 loop {
951 let field_ident = i_prot.read_field_begin()?;
952 if field_ident.field_type == TType::Stop {
953 break;
954 }
955 let field_id = field_id(&field_ident)?;
956 match field_id {
957 0 => {
958 let val = i_prot.read_bool()?;
959 f_0 = Some(val);
960 },
961 _ => {
962 i_prot.skip(field_ident.field_type)?;
963 },
964 };
965 i_prot.read_field_end()?;
966 }
967 i_prot.read_struct_end()?;
968 let ret = LocalizationServiceSwitchContextResult {
969 result_value: f_0,
970 };
971 Ok(ret)
972 }
973 fn write_to_out_protocol(&self, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
974 let struct_ident = TStructIdentifier::new("LocalizationServiceSwitchContextResult");
975 o_prot.write_struct_begin(&struct_ident)?;
976 if let Some(fld_var) = self.result_value {
977 o_prot.write_field_begin(&TFieldIdentifier::new("result_value", TType::Bool, 0))?;
978 o_prot.write_bool(fld_var)?;
979 o_prot.write_field_end()?;
980 ()
981 } else {
982 ()
983 }
984 o_prot.write_field_stop()?;
985 o_prot.write_struct_end()
986 }
987 fn ok_or(self) -> thrift::Result<bool> {
988 if self.result_value.is_some() {
989 Ok(self.result_value.unwrap())
990 } else {
991 Err(
992 thrift::Error::Application(
993 ApplicationError::new(
994 ApplicationErrorKind::MissingResult,
995 "no result received for LocalizationServiceSwitchContext"
996 )
997 )
998 )
999 }
1000 }
1001}
1002
1003#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1008struct LocalizationServiceHintContextArgs {
1009}
1010
1011impl LocalizationServiceHintContextArgs {
1012 fn read_from_in_protocol(i_prot: &mut TInputProtocol) -> thrift::Result<LocalizationServiceHintContextArgs> {
1013 i_prot.read_struct_begin()?;
1014 loop {
1015 let field_ident = i_prot.read_field_begin()?;
1016 if field_ident.field_type == TType::Stop {
1017 break;
1018 }
1019 let field_id = field_id(&field_ident)?;
1020 match field_id {
1021 _ => {
1022 i_prot.skip(field_ident.field_type)?;
1023 },
1024 };
1025 i_prot.read_field_end()?;
1026 }
1027 i_prot.read_struct_end()?;
1028 let ret = LocalizationServiceHintContextArgs {};
1029 Ok(ret)
1030 }
1031 fn write_to_out_protocol(&self, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
1032 let struct_ident = TStructIdentifier::new("HintContext_args");
1033 o_prot.write_struct_begin(&struct_ident)?;
1034 o_prot.write_field_stop()?;
1035 o_prot.write_struct_end()
1036 }
1037}
1038
1039#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1044struct LocalizationServiceHintContextResult {
1045 result_value: Option<String>,
1046}
1047
1048impl LocalizationServiceHintContextResult {
1049 fn read_from_in_protocol(i_prot: &mut TInputProtocol) -> thrift::Result<LocalizationServiceHintContextResult> {
1050 i_prot.read_struct_begin()?;
1051 let mut f_0: Option<String> = None;
1052 loop {
1053 let field_ident = i_prot.read_field_begin()?;
1054 if field_ident.field_type == TType::Stop {
1055 break;
1056 }
1057 let field_id = field_id(&field_ident)?;
1058 match field_id {
1059 0 => {
1060 let val = i_prot.read_string()?;
1061 f_0 = Some(val);
1062 },
1063 _ => {
1064 i_prot.skip(field_ident.field_type)?;
1065 },
1066 };
1067 i_prot.read_field_end()?;
1068 }
1069 i_prot.read_struct_end()?;
1070 let ret = LocalizationServiceHintContextResult {
1071 result_value: f_0,
1072 };
1073 Ok(ret)
1074 }
1075 fn write_to_out_protocol(&self, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
1076 let struct_ident = TStructIdentifier::new("LocalizationServiceHintContextResult");
1077 o_prot.write_struct_begin(&struct_ident)?;
1078 if let Some(ref fld_var) = self.result_value {
1079 o_prot.write_field_begin(&TFieldIdentifier::new("result_value", TType::String, 0))?;
1080 o_prot.write_string(fld_var)?;
1081 o_prot.write_field_end()?;
1082 ()
1083 } else {
1084 ()
1085 }
1086 o_prot.write_field_stop()?;
1087 o_prot.write_struct_end()
1088 }
1089 fn ok_or(self) -> thrift::Result<String> {
1090 if self.result_value.is_some() {
1091 Ok(self.result_value.unwrap())
1092 } else {
1093 Err(
1094 thrift::Error::Application(
1095 ApplicationError::new(
1096 ApplicationErrorKind::MissingResult,
1097 "no result received for LocalizationServiceHintContext"
1098 )
1099 )
1100 )
1101 }
1102 }
1103}
1104
1105#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1110struct LocalizationServiceGetStringArgs {
1111 key: String,
1113 context: String,
1115 language: String,
1117}
1118
1119impl LocalizationServiceGetStringArgs {
1120 fn read_from_in_protocol(i_prot: &mut TInputProtocol) -> thrift::Result<LocalizationServiceGetStringArgs> {
1121 i_prot.read_struct_begin()?;
1122 let mut f_1: Option<String> = None;
1123 let mut f_2: Option<String> = None;
1124 let mut f_3: Option<String> = None;
1125 loop {
1126 let field_ident = i_prot.read_field_begin()?;
1127 if field_ident.field_type == TType::Stop {
1128 break;
1129 }
1130 let field_id = field_id(&field_ident)?;
1131 match field_id {
1132 1 => {
1133 let val = i_prot.read_string()?;
1134 f_1 = Some(val);
1135 },
1136 2 => {
1137 let val = i_prot.read_string()?;
1138 f_2 = Some(val);
1139 },
1140 3 => {
1141 let val = i_prot.read_string()?;
1142 f_3 = Some(val);
1143 },
1144 _ => {
1145 i_prot.skip(field_ident.field_type)?;
1146 },
1147 };
1148 i_prot.read_field_end()?;
1149 }
1150 i_prot.read_struct_end()?;
1151 verify_required_field_exists("LocalizationServiceGetStringArgs.key", &f_1)?;
1152 verify_required_field_exists("LocalizationServiceGetStringArgs.context", &f_2)?;
1153 verify_required_field_exists("LocalizationServiceGetStringArgs.language", &f_3)?;
1154 let ret = LocalizationServiceGetStringArgs {
1155 key: f_1.expect("auto-generated code should have checked for presence of required fields"),
1156 context: f_2.expect("auto-generated code should have checked for presence of required fields"),
1157 language: f_3.expect("auto-generated code should have checked for presence of required fields"),
1158 };
1159 Ok(ret)
1160 }
1161 fn write_to_out_protocol(&self, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
1162 let struct_ident = TStructIdentifier::new("GetString_args");
1163 o_prot.write_struct_begin(&struct_ident)?;
1164 o_prot.write_field_begin(&TFieldIdentifier::new("key", TType::String, 1))?;
1165 o_prot.write_string(&self.key)?;
1166 o_prot.write_field_end()?;
1167 o_prot.write_field_begin(&TFieldIdentifier::new("context", TType::String, 2))?;
1168 o_prot.write_string(&self.context)?;
1169 o_prot.write_field_end()?;
1170 o_prot.write_field_begin(&TFieldIdentifier::new("language", TType::String, 3))?;
1171 o_prot.write_string(&self.language)?;
1172 o_prot.write_field_end()?;
1173 o_prot.write_field_stop()?;
1174 o_prot.write_struct_end()
1175 }
1176}
1177
1178#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1183struct LocalizationServiceGetStringResult {
1184 result_value: Option<String>,
1185}
1186
1187impl LocalizationServiceGetStringResult {
1188 fn read_from_in_protocol(i_prot: &mut TInputProtocol) -> thrift::Result<LocalizationServiceGetStringResult> {
1189 i_prot.read_struct_begin()?;
1190 let mut f_0: Option<String> = None;
1191 loop {
1192 let field_ident = i_prot.read_field_begin()?;
1193 if field_ident.field_type == TType::Stop {
1194 break;
1195 }
1196 let field_id = field_id(&field_ident)?;
1197 match field_id {
1198 0 => {
1199 let val = i_prot.read_string()?;
1200 f_0 = Some(val);
1201 },
1202 _ => {
1203 i_prot.skip(field_ident.field_type)?;
1204 },
1205 };
1206 i_prot.read_field_end()?;
1207 }
1208 i_prot.read_struct_end()?;
1209 let ret = LocalizationServiceGetStringResult {
1210 result_value: f_0,
1211 };
1212 Ok(ret)
1213 }
1214 fn write_to_out_protocol(&self, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
1215 let struct_ident = TStructIdentifier::new("LocalizationServiceGetStringResult");
1216 o_prot.write_struct_begin(&struct_ident)?;
1217 if let Some(ref fld_var) = self.result_value {
1218 o_prot.write_field_begin(&TFieldIdentifier::new("result_value", TType::String, 0))?;
1219 o_prot.write_string(fld_var)?;
1220 o_prot.write_field_end()?;
1221 ()
1222 } else {
1223 ()
1224 }
1225 o_prot.write_field_stop()?;
1226 o_prot.write_struct_end()
1227 }
1228 fn ok_or(self) -> thrift::Result<String> {
1229 if self.result_value.is_some() {
1230 Ok(self.result_value.unwrap())
1231 } else {
1232 Err(
1233 thrift::Error::Application(
1234 ApplicationError::new(
1235 ApplicationErrorKind::MissingResult,
1236 "no result received for LocalizationServiceGetString"
1237 )
1238 )
1239 )
1240 }
1241 }
1242}
1243
1244#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1249struct LocalizationServiceGetStringsArgs {
1250 filter: String,
1252 context: String,
1254 language: String,
1256}
1257
1258impl LocalizationServiceGetStringsArgs {
1259 fn read_from_in_protocol(i_prot: &mut TInputProtocol) -> thrift::Result<LocalizationServiceGetStringsArgs> {
1260 i_prot.read_struct_begin()?;
1261 let mut f_1: Option<String> = None;
1262 let mut f_2: Option<String> = None;
1263 let mut f_3: Option<String> = None;
1264 loop {
1265 let field_ident = i_prot.read_field_begin()?;
1266 if field_ident.field_type == TType::Stop {
1267 break;
1268 }
1269 let field_id = field_id(&field_ident)?;
1270 match field_id {
1271 1 => {
1272 let val = i_prot.read_string()?;
1273 f_1 = Some(val);
1274 },
1275 2 => {
1276 let val = i_prot.read_string()?;
1277 f_2 = Some(val);
1278 },
1279 3 => {
1280 let val = i_prot.read_string()?;
1281 f_3 = Some(val);
1282 },
1283 _ => {
1284 i_prot.skip(field_ident.field_type)?;
1285 },
1286 };
1287 i_prot.read_field_end()?;
1288 }
1289 i_prot.read_struct_end()?;
1290 verify_required_field_exists("LocalizationServiceGetStringsArgs.filter", &f_1)?;
1291 verify_required_field_exists("LocalizationServiceGetStringsArgs.context", &f_2)?;
1292 verify_required_field_exists("LocalizationServiceGetStringsArgs.language", &f_3)?;
1293 let ret = LocalizationServiceGetStringsArgs {
1294 filter: f_1.expect("auto-generated code should have checked for presence of required fields"),
1295 context: f_2.expect("auto-generated code should have checked for presence of required fields"),
1296 language: f_3.expect("auto-generated code should have checked for presence of required fields"),
1297 };
1298 Ok(ret)
1299 }
1300 fn write_to_out_protocol(&self, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
1301 let struct_ident = TStructIdentifier::new("GetStrings_args");
1302 o_prot.write_struct_begin(&struct_ident)?;
1303 o_prot.write_field_begin(&TFieldIdentifier::new("filter", TType::String, 1))?;
1304 o_prot.write_string(&self.filter)?;
1305 o_prot.write_field_end()?;
1306 o_prot.write_field_begin(&TFieldIdentifier::new("context", TType::String, 2))?;
1307 o_prot.write_string(&self.context)?;
1308 o_prot.write_field_end()?;
1309 o_prot.write_field_begin(&TFieldIdentifier::new("language", TType::String, 3))?;
1310 o_prot.write_string(&self.language)?;
1311 o_prot.write_field_end()?;
1312 o_prot.write_field_stop()?;
1313 o_prot.write_struct_end()
1314 }
1315}
1316
1317#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1322struct LocalizationServiceGetStringsResult {
1323 result_value: Option<BTreeMap<String, String>>,
1324}
1325
1326impl LocalizationServiceGetStringsResult {
1327 fn read_from_in_protocol(i_prot: &mut TInputProtocol) -> thrift::Result<LocalizationServiceGetStringsResult> {
1328 i_prot.read_struct_begin()?;
1329 let mut f_0: Option<BTreeMap<String, String>> = None;
1330 loop {
1331 let field_ident = i_prot.read_field_begin()?;
1332 if field_ident.field_type == TType::Stop {
1333 break;
1334 }
1335 let field_id = field_id(&field_ident)?;
1336 match field_id {
1337 0 => {
1338 let map_ident = i_prot.read_map_begin()?;
1339 let mut val: BTreeMap<String, String> = BTreeMap::new();
1340 for _ in 0..map_ident.size {
1341 let map_key_0 = i_prot.read_string()?;
1342 let map_val_1 = i_prot.read_string()?;
1343 val.insert(map_key_0, map_val_1);
1344 }
1345 i_prot.read_map_end()?;
1346 f_0 = Some(val);
1347 },
1348 _ => {
1349 i_prot.skip(field_ident.field_type)?;
1350 },
1351 };
1352 i_prot.read_field_end()?;
1353 }
1354 i_prot.read_struct_end()?;
1355 let ret = LocalizationServiceGetStringsResult {
1356 result_value: f_0,
1357 };
1358 Ok(ret)
1359 }
1360 fn write_to_out_protocol(&self, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
1361 let struct_ident = TStructIdentifier::new("LocalizationServiceGetStringsResult");
1362 o_prot.write_struct_begin(&struct_ident)?;
1363 if let Some(ref fld_var) = self.result_value {
1364 o_prot.write_field_begin(&TFieldIdentifier::new("result_value", TType::Map, 0))?;
1365 o_prot.write_map_begin(&TMapIdentifier::new(TType::String, TType::String, fld_var.len() as i32))?;
1366 for (k, v) in fld_var {
1367 o_prot.write_string(k)?;
1368 o_prot.write_string(v)?;
1369 o_prot.write_map_end()?;
1370 }
1371 o_prot.write_field_end()?;
1372 ()
1373 } else {
1374 ()
1375 }
1376 o_prot.write_field_stop()?;
1377 o_prot.write_struct_end()
1378 }
1379 fn ok_or(self) -> thrift::Result<BTreeMap<String, String>> {
1380 if self.result_value.is_some() {
1381 Ok(self.result_value.unwrap())
1382 } else {
1383 Err(
1384 thrift::Error::Application(
1385 ApplicationError::new(
1386 ApplicationErrorKind::MissingResult,
1387 "no result received for LocalizationServiceGetStrings"
1388 )
1389 )
1390 )
1391 }
1392 }
1393}
1394
1395#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1400struct LocalizationServiceGetFileNameArgs {
1401 filename: String,
1403 is_virtual_path: bool,
1405 context: String,
1407}
1408
1409impl LocalizationServiceGetFileNameArgs {
1410 fn read_from_in_protocol(i_prot: &mut TInputProtocol) -> thrift::Result<LocalizationServiceGetFileNameArgs> {
1411 i_prot.read_struct_begin()?;
1412 let mut f_1: Option<String> = None;
1413 let mut f_2: Option<bool> = None;
1414 let mut f_3: Option<String> = None;
1415 loop {
1416 let field_ident = i_prot.read_field_begin()?;
1417 if field_ident.field_type == TType::Stop {
1418 break;
1419 }
1420 let field_id = field_id(&field_ident)?;
1421 match field_id {
1422 1 => {
1423 let val = i_prot.read_string()?;
1424 f_1 = Some(val);
1425 },
1426 2 => {
1427 let val = i_prot.read_bool()?;
1428 f_2 = Some(val);
1429 },
1430 3 => {
1431 let val = i_prot.read_string()?;
1432 f_3 = Some(val);
1433 },
1434 _ => {
1435 i_prot.skip(field_ident.field_type)?;
1436 },
1437 };
1438 i_prot.read_field_end()?;
1439 }
1440 i_prot.read_struct_end()?;
1441 verify_required_field_exists("LocalizationServiceGetFileNameArgs.filename", &f_1)?;
1442 verify_required_field_exists("LocalizationServiceGetFileNameArgs.is_virtual_path", &f_2)?;
1443 verify_required_field_exists("LocalizationServiceGetFileNameArgs.context", &f_3)?;
1444 let ret = LocalizationServiceGetFileNameArgs {
1445 filename: f_1.expect("auto-generated code should have checked for presence of required fields"),
1446 is_virtual_path: f_2.expect("auto-generated code should have checked for presence of required fields"),
1447 context: f_3.expect("auto-generated code should have checked for presence of required fields"),
1448 };
1449 Ok(ret)
1450 }
1451 fn write_to_out_protocol(&self, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
1452 let struct_ident = TStructIdentifier::new("GetFileName_args");
1453 o_prot.write_struct_begin(&struct_ident)?;
1454 o_prot.write_field_begin(&TFieldIdentifier::new("filename", TType::String, 1))?;
1455 o_prot.write_string(&self.filename)?;
1456 o_prot.write_field_end()?;
1457 o_prot.write_field_begin(&TFieldIdentifier::new("isVirtualPath", TType::Bool, 2))?;
1458 o_prot.write_bool(self.is_virtual_path)?;
1459 o_prot.write_field_end()?;
1460 o_prot.write_field_begin(&TFieldIdentifier::new("context", TType::String, 3))?;
1461 o_prot.write_string(&self.context)?;
1462 o_prot.write_field_end()?;
1463 o_prot.write_field_stop()?;
1464 o_prot.write_struct_end()
1465 }
1466}
1467
1468#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1473struct LocalizationServiceGetFileNameResult {
1474 result_value: Option<String>,
1475}
1476
1477impl LocalizationServiceGetFileNameResult {
1478 fn read_from_in_protocol(i_prot: &mut TInputProtocol) -> thrift::Result<LocalizationServiceGetFileNameResult> {
1479 i_prot.read_struct_begin()?;
1480 let mut f_0: Option<String> = None;
1481 loop {
1482 let field_ident = i_prot.read_field_begin()?;
1483 if field_ident.field_type == TType::Stop {
1484 break;
1485 }
1486 let field_id = field_id(&field_ident)?;
1487 match field_id {
1488 0 => {
1489 let val = i_prot.read_string()?;
1490 f_0 = Some(val);
1491 },
1492 _ => {
1493 i_prot.skip(field_ident.field_type)?;
1494 },
1495 };
1496 i_prot.read_field_end()?;
1497 }
1498 i_prot.read_struct_end()?;
1499 let ret = LocalizationServiceGetFileNameResult {
1500 result_value: f_0,
1501 };
1502 Ok(ret)
1503 }
1504 fn write_to_out_protocol(&self, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
1505 let struct_ident = TStructIdentifier::new("LocalizationServiceGetFileNameResult");
1506 o_prot.write_struct_begin(&struct_ident)?;
1507 if let Some(ref fld_var) = self.result_value {
1508 o_prot.write_field_begin(&TFieldIdentifier::new("result_value", TType::String, 0))?;
1509 o_prot.write_string(fld_var)?;
1510 o_prot.write_field_end()?;
1511 ()
1512 } else {
1513 ()
1514 }
1515 o_prot.write_field_stop()?;
1516 o_prot.write_struct_end()
1517 }
1518 fn ok_or(self) -> thrift::Result<String> {
1519 if self.result_value.is_some() {
1520 Ok(self.result_value.unwrap())
1521 } else {
1522 Err(
1523 thrift::Error::Application(
1524 ApplicationError::new(
1525 ApplicationErrorKind::MissingResult,
1526 "no result received for LocalizationServiceGetFileName"
1527 )
1528 )
1529 )
1530 }
1531 }
1532}
1533