1 // @generated by Thrift for src/module.thrift 2 // This file is probably not the place you want to edit! 3 4 #![recursion_limit = "100000000"] 5 #![allow(non_camel_case_types, non_snake_case, non_upper_case_globals, unused_crate_dependencies)] 6 7 pub use self::errors::*; 8 pub use self::types::*; 9 10 /// Thrift type definitions for `module`. 11 pub mod types { 12 #![allow(clippy::redundant_closure)] 13 14 15 #[derive(Clone, PartialEq)] 16 pub struct MyStruct { 17 pub MyIntField: ::std::primitive::i64, 18 pub MyStringField: ::std::string::String, 19 pub MyDataField: crate::types::MyDataItem, 20 pub myEnum: crate::types::MyEnum, 21 // This field forces `..Default::default()` when instantiating this 22 // struct, to make code future-proof against new fields added later to 23 // the definition in Thrift. If you don't want this, add the annotation 24 // `(rust.exhaustive)` to the Thrift struct to eliminate this field. 25 #[doc(hidden)] 26 pub _dot_dot_Default_default: self::dot_dot::OtherFields, 27 } 28 29 #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] 30 pub struct MyDataItem { 31 // This field forces `..Default::default()` when instantiating this 32 // struct, to make code future-proof against new fields added later to 33 // the definition in Thrift. If you don't want this, add the annotation 34 // `(rust.exhaustive)` to the Thrift struct to eliminate this field. 35 #[doc(hidden)] 36 pub _dot_dot_Default_default: self::dot_dot::OtherFields, 37 } 38 39 #[derive(Clone, PartialEq, Debug)] 40 pub enum MyUnion { 41 myEnum(crate::types::MyEnum), 42 myStruct(crate::types::MyStruct), 43 myDataItem(crate::types::MyDataItem), 44 UnknownField(::std::primitive::i32), 45 } 46 47 #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] 48 pub struct MyException { 49 // This field forces `..Default::default()` when instantiating this 50 // struct, to make code future-proof against new fields added later to 51 // the definition in Thrift. If you don't want this, add the annotation 52 // `(rust.exhaustive)` to the Thrift struct to eliminate this field. 53 #[doc(hidden)] 54 pub _dot_dot_Default_default: self::dot_dot::OtherFields, 55 } 56 57 impl ::fbthrift::ExceptionInfo for MyException { exn_value(&self) -> String58 fn exn_value(&self) -> String { 59 format!("{:?}", self) 60 } 61 62 #[inline] exn_is_declared(&self) -> bool63 fn exn_is_declared(&self) -> bool { true } 64 } 65 66 impl ::std::error::Error for MyException {} 67 68 impl ::std::fmt::Display for MyException { fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result69 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { 70 write!(f, "{:?}", self) 71 } 72 } 73 74 #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] 75 pub struct MyEnum(pub ::std::primitive::i32); 76 77 impl MyEnum { 78 pub const MyValue1: Self = MyEnum(0i32); 79 pub const MyValue2: Self = MyEnum(1i32); 80 } 81 82 impl ::fbthrift::ThriftEnum for MyEnum { enumerate() -> &'static [(MyEnum, &'static str)]83 fn enumerate() -> &'static [(MyEnum, &'static str)] { 84 &[ 85 (MyEnum::MyValue1, "MyValue1"), 86 (MyEnum::MyValue2, "MyValue2"), 87 ] 88 } 89 variants() -> &'static [&'static str]90 fn variants() -> &'static [&'static str] { 91 &[ 92 "MyValue1", 93 "MyValue2", 94 ] 95 } 96 variant_values() -> &'static [MyEnum]97 fn variant_values() -> &'static [MyEnum] { 98 &[ 99 MyEnum::MyValue1, 100 MyEnum::MyValue2, 101 ] 102 } 103 } 104 105 impl ::std::default::Default for MyEnum { default() -> Self106 fn default() -> Self { 107 MyEnum(::fbthrift::__UNKNOWN_ID) 108 } 109 } 110 111 impl<'a> ::std::convert::From<&'a MyEnum> for ::std::primitive::i32 { 112 #[inline] from(x: &'a MyEnum) -> Self113 fn from(x: &'a MyEnum) -> Self { 114 x.0 115 } 116 } 117 118 impl ::std::convert::From<MyEnum> for ::std::primitive::i32 { 119 #[inline] from(x: MyEnum) -> Self120 fn from(x: MyEnum) -> Self { 121 x.0 122 } 123 } 124 125 impl ::std::convert::From<::std::primitive::i32> for MyEnum { 126 #[inline] from(x: ::std::primitive::i32) -> Self127 fn from(x: ::std::primitive::i32) -> Self { 128 Self(x) 129 } 130 } 131 132 impl ::std::fmt::Display for MyEnum { fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result133 fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { 134 static VARIANTS_BY_NUMBER: &[(&::std::primitive::str, ::std::primitive::i32)] = &[ 135 ("MyValue1", 0), 136 ("MyValue2", 1), 137 ]; 138 ::fbthrift::help::enum_display(VARIANTS_BY_NUMBER, fmt, self.0) 139 } 140 } 141 142 impl ::std::fmt::Debug for MyEnum { fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result143 fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { 144 write!(fmt, "MyEnum::{}", self) 145 } 146 } 147 148 impl ::std::str::FromStr for MyEnum { 149 type Err = ::anyhow::Error; 150 from_str(string: &::std::primitive::str) -> ::std::result::Result<Self, Self::Err>151 fn from_str(string: &::std::primitive::str) -> ::std::result::Result<Self, Self::Err> { 152 static VARIANTS_BY_NAME: &[(&::std::primitive::str, ::std::primitive::i32)] = &[ 153 ("MyValue1", 0), 154 ("MyValue2", 1), 155 ]; 156 ::fbthrift::help::enum_from_str(VARIANTS_BY_NAME, string, "MyEnum").map(MyEnum) 157 } 158 } 159 160 impl ::fbthrift::GetTType for MyEnum { 161 const TTYPE: ::fbthrift::TType = ::fbthrift::TType::I32; 162 } 163 164 impl<P> ::fbthrift::Serialize<P> for MyEnum 165 where 166 P: ::fbthrift::ProtocolWriter, 167 { 168 #[inline] write(&self, p: &mut P)169 fn write(&self, p: &mut P) { 170 p.write_i32(self.into()) 171 } 172 } 173 174 impl<P> ::fbthrift::Deserialize<P> for MyEnum 175 where 176 P: ::fbthrift::ProtocolReader, 177 { 178 #[inline] read(p: &mut P) -> ::anyhow::Result<Self>179 fn read(p: &mut P) -> ::anyhow::Result<Self> { 180 ::std::result::Result::Ok(MyEnum::from(p.read_i32()?)) 181 } 182 } 183 184 impl ::std::default::Default for self::MyStruct { default() -> Self185 fn default() -> Self { 186 Self { 187 MyIntField: ::std::default::Default::default(), 188 MyStringField: ::std::default::Default::default(), 189 MyDataField: ::std::default::Default::default(), 190 myEnum: ::std::default::Default::default(), 191 _dot_dot_Default_default: self::dot_dot::OtherFields(()), 192 } 193 } 194 } 195 196 impl ::std::fmt::Debug for self::MyStruct { fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result197 fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { 198 formatter 199 .debug_struct("MyStruct") 200 .field("MyIntField", &self.MyIntField) 201 .field("MyStringField", &self.MyStringField) 202 .field("MyDataField", &self.MyDataField) 203 .field("myEnum", &self.myEnum) 204 .finish() 205 } 206 } 207 208 unsafe impl ::std::marker::Send for self::MyStruct {} 209 unsafe impl ::std::marker::Sync for self::MyStruct {} 210 211 impl ::fbthrift::GetTType for self::MyStruct { 212 const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct; 213 } 214 215 impl<P> ::fbthrift::Serialize<P> for self::MyStruct 216 where 217 P: ::fbthrift::ProtocolWriter, 218 { write(&self, p: &mut P)219 fn write(&self, p: &mut P) { 220 p.write_struct_begin("MyStruct"); 221 p.write_field_begin("MyIntField", ::fbthrift::TType::I64, 1); 222 ::fbthrift::Serialize::write(&self.MyIntField, p); 223 p.write_field_end(); 224 p.write_field_begin("MyStringField", ::fbthrift::TType::String, 2); 225 ::fbthrift::Serialize::write(&self.MyStringField, p); 226 p.write_field_end(); 227 p.write_field_begin("MyDataField", ::fbthrift::TType::Struct, 3); 228 ::fbthrift::Serialize::write(&self.MyDataField, p); 229 p.write_field_end(); 230 p.write_field_begin("myEnum", ::fbthrift::TType::I32, 4); 231 ::fbthrift::Serialize::write(&self.myEnum, p); 232 p.write_field_end(); 233 p.write_field_stop(); 234 p.write_struct_end(); 235 } 236 } 237 238 impl<P> ::fbthrift::Deserialize<P> for self::MyStruct 239 where 240 P: ::fbthrift::ProtocolReader, 241 { read(p: &mut P) -> ::anyhow::Result<Self>242 fn read(p: &mut P) -> ::anyhow::Result<Self> { 243 static FIELDS: &[::fbthrift::Field] = &[ 244 ::fbthrift::Field::new("MyDataField", ::fbthrift::TType::Struct, 3), 245 ::fbthrift::Field::new("MyIntField", ::fbthrift::TType::I64, 1), 246 ::fbthrift::Field::new("MyStringField", ::fbthrift::TType::String, 2), 247 ::fbthrift::Field::new("myEnum", ::fbthrift::TType::I32, 4), 248 ]; 249 let mut field_MyIntField = ::std::option::Option::None; 250 let mut field_MyStringField = ::std::option::Option::None; 251 let mut field_MyDataField = ::std::option::Option::None; 252 let mut field_myEnum = ::std::option::Option::None; 253 let _ = p.read_struct_begin(|_| ())?; 254 loop { 255 let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?; 256 match (fty, fid as ::std::primitive::i32) { 257 (::fbthrift::TType::Stop, _) => break, 258 (::fbthrift::TType::I64, 1) => field_MyIntField = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), 259 (::fbthrift::TType::String, 2) => field_MyStringField = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), 260 (::fbthrift::TType::Struct, 3) => field_MyDataField = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), 261 (::fbthrift::TType::I32, 4) => field_myEnum = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), 262 (fty, _) => p.skip(fty)?, 263 } 264 p.read_field_end()?; 265 } 266 p.read_struct_end()?; 267 ::std::result::Result::Ok(Self { 268 MyIntField: field_MyIntField.unwrap_or_default(), 269 MyStringField: field_MyStringField.unwrap_or_default(), 270 MyDataField: field_MyDataField.unwrap_or_default(), 271 myEnum: field_myEnum.unwrap_or_default(), 272 _dot_dot_Default_default: self::dot_dot::OtherFields(()), 273 }) 274 } 275 } 276 277 278 impl ::std::default::Default for self::MyDataItem { default() -> Self279 fn default() -> Self { 280 Self { 281 _dot_dot_Default_default: self::dot_dot::OtherFields(()), 282 } 283 } 284 } 285 286 impl ::std::fmt::Debug for self::MyDataItem { fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result287 fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { 288 formatter 289 .debug_struct("MyDataItem") 290 .finish() 291 } 292 } 293 294 unsafe impl ::std::marker::Send for self::MyDataItem {} 295 unsafe impl ::std::marker::Sync for self::MyDataItem {} 296 297 impl ::fbthrift::GetTType for self::MyDataItem { 298 const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct; 299 } 300 301 impl<P> ::fbthrift::Serialize<P> for self::MyDataItem 302 where 303 P: ::fbthrift::ProtocolWriter, 304 { write(&self, p: &mut P)305 fn write(&self, p: &mut P) { 306 p.write_struct_begin("MyDataItem"); 307 p.write_field_stop(); 308 p.write_struct_end(); 309 } 310 } 311 312 impl<P> ::fbthrift::Deserialize<P> for self::MyDataItem 313 where 314 P: ::fbthrift::ProtocolReader, 315 { read(p: &mut P) -> ::anyhow::Result<Self>316 fn read(p: &mut P) -> ::anyhow::Result<Self> { 317 static FIELDS: &[::fbthrift::Field] = &[ 318 ]; 319 let _ = p.read_struct_begin(|_| ())?; 320 loop { 321 let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?; 322 match (fty, fid as ::std::primitive::i32) { 323 (::fbthrift::TType::Stop, _) => break, 324 (fty, _) => p.skip(fty)?, 325 } 326 p.read_field_end()?; 327 } 328 p.read_struct_end()?; 329 ::std::result::Result::Ok(Self { 330 _dot_dot_Default_default: self::dot_dot::OtherFields(()), 331 }) 332 } 333 } 334 335 336 337 impl ::std::default::Default for MyUnion { default() -> Self338 fn default() -> Self { 339 Self::UnknownField(-1) 340 } 341 } 342 343 impl ::fbthrift::GetTType for MyUnion { 344 const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct; 345 } 346 347 impl<P> ::fbthrift::Serialize<P> for MyUnion 348 where 349 P: ::fbthrift::ProtocolWriter, 350 { write(&self, p: &mut P)351 fn write(&self, p: &mut P) { 352 p.write_struct_begin("MyUnion"); 353 match self { 354 MyUnion::myEnum(inner) => { 355 p.write_field_begin("myEnum", ::fbthrift::TType::I32, 1); 356 ::fbthrift::Serialize::write(inner, p); 357 p.write_field_end(); 358 } 359 MyUnion::myStruct(inner) => { 360 p.write_field_begin("myStruct", ::fbthrift::TType::Struct, 2); 361 ::fbthrift::Serialize::write(inner, p); 362 p.write_field_end(); 363 } 364 MyUnion::myDataItem(inner) => { 365 p.write_field_begin("myDataItem", ::fbthrift::TType::Struct, 3); 366 ::fbthrift::Serialize::write(inner, p); 367 p.write_field_end(); 368 } 369 MyUnion::UnknownField(_) => {} 370 } 371 p.write_field_stop(); 372 p.write_struct_end(); 373 } 374 } 375 376 impl<P> ::fbthrift::Deserialize<P> for MyUnion 377 where 378 P: ::fbthrift::ProtocolReader, 379 { read(p: &mut P) -> ::anyhow::Result<Self>380 fn read(p: &mut P) -> ::anyhow::Result<Self> { 381 static FIELDS: &[::fbthrift::Field] = &[ 382 ::fbthrift::Field::new("myDataItem", ::fbthrift::TType::Struct, 3), 383 ::fbthrift::Field::new("myEnum", ::fbthrift::TType::I32, 1), 384 ::fbthrift::Field::new("myStruct", ::fbthrift::TType::Struct, 2), 385 ]; 386 let _ = p.read_struct_begin(|_| ())?; 387 let mut once = false; 388 let mut alt = ::std::option::Option::None; 389 loop { 390 let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?; 391 match (fty, fid as ::std::primitive::i32, once) { 392 (::fbthrift::TType::Stop, _, _) => break, 393 (::fbthrift::TType::I32, 1, false) => { 394 once = true; 395 alt = ::std::option::Option::Some(MyUnion::myEnum(::fbthrift::Deserialize::read(p)?)); 396 } 397 (::fbthrift::TType::Struct, 2, false) => { 398 once = true; 399 alt = ::std::option::Option::Some(MyUnion::myStruct(::fbthrift::Deserialize::read(p)?)); 400 } 401 (::fbthrift::TType::Struct, 3, false) => { 402 once = true; 403 alt = ::std::option::Option::Some(MyUnion::myDataItem(::fbthrift::Deserialize::read(p)?)); 404 } 405 (fty, _, false) => p.skip(fty)?, 406 (badty, badid, true) => return ::std::result::Result::Err(::std::convert::From::from(::fbthrift::ApplicationException::new( 407 ::fbthrift::ApplicationExceptionErrorCode::ProtocolError, 408 format!( 409 "unwanted extra union {} field ty {:?} id {}", 410 "MyUnion", 411 badty, 412 badid, 413 ), 414 ))), 415 } 416 p.read_field_end()?; 417 } 418 p.read_struct_end()?; 419 ::std::result::Result::Ok(alt.unwrap_or_default()) 420 } 421 } 422 423 impl ::std::default::Default for self::MyException { default() -> Self424 fn default() -> Self { 425 Self { 426 _dot_dot_Default_default: self::dot_dot::OtherFields(()), 427 } 428 } 429 } 430 431 impl ::std::fmt::Debug for self::MyException { fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result432 fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { 433 formatter 434 .debug_struct("MyException") 435 .finish() 436 } 437 } 438 439 unsafe impl ::std::marker::Send for self::MyException {} 440 unsafe impl ::std::marker::Sync for self::MyException {} 441 442 impl ::fbthrift::GetTType for self::MyException { 443 const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct; 444 } 445 446 impl<P> ::fbthrift::Serialize<P> for self::MyException 447 where 448 P: ::fbthrift::ProtocolWriter, 449 { write(&self, p: &mut P)450 fn write(&self, p: &mut P) { 451 p.write_struct_begin("MyException"); 452 p.write_field_stop(); 453 p.write_struct_end(); 454 } 455 } 456 457 impl<P> ::fbthrift::Deserialize<P> for self::MyException 458 where 459 P: ::fbthrift::ProtocolReader, 460 { read(p: &mut P) -> ::anyhow::Result<Self>461 fn read(p: &mut P) -> ::anyhow::Result<Self> { 462 static FIELDS: &[::fbthrift::Field] = &[ 463 ]; 464 let _ = p.read_struct_begin(|_| ())?; 465 loop { 466 let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?; 467 match (fty, fid as ::std::primitive::i32) { 468 (::fbthrift::TType::Stop, _) => break, 469 (fty, _) => p.skip(fty)?, 470 } 471 p.read_field_end()?; 472 } 473 p.read_struct_end()?; 474 ::std::result::Result::Ok(Self { 475 _dot_dot_Default_default: self::dot_dot::OtherFields(()), 476 }) 477 } 478 } 479 480 481 mod dot_dot { 482 #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] 483 pub struct OtherFields(pub(crate) ()); 484 } 485 } 486 487 #[doc(hidden)] 488 pub mod dependencies { 489 } 490 491 pub mod services { 492 pub mod my_service { 493 494 #[derive(Clone, Debug)] 495 pub enum PingExn { 496 Success(()), 497 ApplicationException(::fbthrift::ApplicationException), 498 } 499 500 impl ::std::convert::From<::fbthrift::ApplicationException> for PingExn { from(exn: ::fbthrift::ApplicationException) -> Self501 fn from(exn: ::fbthrift::ApplicationException) -> Self { 502 PingExn::ApplicationException(exn) 503 } 504 } 505 506 impl ::fbthrift::ExceptionInfo for PingExn { exn_name(&self) -> &'static str507 fn exn_name(&self) -> &'static str { 508 match self { 509 PingExn::Success(_) => panic!("ExceptionInfo::exn_name called on Success"), 510 PingExn::ApplicationException(aexn) => aexn.exn_name(), 511 } 512 } 513 exn_value(&self) -> String514 fn exn_value(&self) -> String { 515 match self { 516 PingExn::Success(_) => panic!("ExceptionInfo::exn_value called on Success"), 517 PingExn::ApplicationException(aexn) => aexn.exn_value(), 518 } 519 } 520 exn_is_declared(&self) -> bool521 fn exn_is_declared(&self) -> bool { 522 match self { 523 PingExn::Success(_) => panic!("ExceptionInfo::exn_is_declared called on Success"), 524 PingExn::ApplicationException(aexn) => aexn.exn_is_declared(), 525 } 526 } 527 } 528 529 impl ::fbthrift::ResultInfo for PingExn { result_type(&self) -> ::fbthrift::ResultType530 fn result_type(&self) -> ::fbthrift::ResultType { 531 match self { 532 PingExn::Success(_) => ::fbthrift::ResultType::Return, 533 PingExn::ApplicationException(_aexn) => ::fbthrift::ResultType::Exception, 534 } 535 } 536 } 537 538 impl ::fbthrift::GetTType for PingExn { 539 const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct; 540 } 541 542 impl<P> ::fbthrift::Serialize<P> for PingExn 543 where 544 P: ::fbthrift::ProtocolWriter, 545 { write(&self, p: &mut P)546 fn write(&self, p: &mut P) { 547 if let PingExn::ApplicationException(aexn) = self { 548 return aexn.write(p); 549 } 550 p.write_struct_begin("Ping"); 551 match self { 552 PingExn::Success(inner) => { 553 p.write_field_begin( 554 "Success", 555 ::fbthrift::TType::Void, 556 0i16, 557 ); 558 inner.write(p); 559 p.write_field_end(); 560 } 561 PingExn::ApplicationException(_aexn) => unreachable!(), 562 } 563 p.write_field_stop(); 564 p.write_struct_end(); 565 } 566 } 567 568 impl<P> ::fbthrift::Deserialize<P> for PingExn 569 where 570 P: ::fbthrift::ProtocolReader, 571 { read(p: &mut P) -> ::anyhow::Result<Self>572 fn read(p: &mut P) -> ::anyhow::Result<Self> { 573 static RETURNS: &[::fbthrift::Field] = &[ 574 ::fbthrift::Field::new("Success", ::fbthrift::TType::Void, 0), 575 ]; 576 let _ = p.read_struct_begin(|_| ())?; 577 let mut once = false; 578 let mut alt = PingExn::Success(()); 579 loop { 580 let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?; 581 match ((fty, fid as ::std::primitive::i32), once) { 582 ((::fbthrift::TType::Stop, _), _) => { 583 p.read_field_end()?; 584 break; 585 } 586 ((::fbthrift::TType::Void, 0i32), false) => { 587 once = true; 588 alt = PingExn::Success(::fbthrift::Deserialize::read(p)?); 589 } 590 ((ty, _id), false) => p.skip(ty)?, 591 ((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from( 592 ::fbthrift::ApplicationException::new( 593 ::fbthrift::ApplicationExceptionErrorCode::ProtocolError, 594 format!( 595 "unwanted extra union {} field ty {:?} id {}", 596 "PingExn", 597 badty, 598 badid, 599 ), 600 ) 601 )), 602 } 603 p.read_field_end()?; 604 } 605 p.read_struct_end()?; 606 ::std::result::Result::Ok(alt) 607 } 608 } 609 610 #[derive(Clone, Debug)] 611 pub enum GetRandomDataExn { 612 Success(::std::string::String), 613 ApplicationException(::fbthrift::ApplicationException), 614 } 615 616 impl ::std::convert::From<::fbthrift::ApplicationException> for GetRandomDataExn { from(exn: ::fbthrift::ApplicationException) -> Self617 fn from(exn: ::fbthrift::ApplicationException) -> Self { 618 GetRandomDataExn::ApplicationException(exn) 619 } 620 } 621 622 impl ::fbthrift::ExceptionInfo for GetRandomDataExn { exn_name(&self) -> &'static str623 fn exn_name(&self) -> &'static str { 624 match self { 625 GetRandomDataExn::Success(_) => panic!("ExceptionInfo::exn_name called on Success"), 626 GetRandomDataExn::ApplicationException(aexn) => aexn.exn_name(), 627 } 628 } 629 exn_value(&self) -> String630 fn exn_value(&self) -> String { 631 match self { 632 GetRandomDataExn::Success(_) => panic!("ExceptionInfo::exn_value called on Success"), 633 GetRandomDataExn::ApplicationException(aexn) => aexn.exn_value(), 634 } 635 } 636 exn_is_declared(&self) -> bool637 fn exn_is_declared(&self) -> bool { 638 match self { 639 GetRandomDataExn::Success(_) => panic!("ExceptionInfo::exn_is_declared called on Success"), 640 GetRandomDataExn::ApplicationException(aexn) => aexn.exn_is_declared(), 641 } 642 } 643 } 644 645 impl ::fbthrift::ResultInfo for GetRandomDataExn { result_type(&self) -> ::fbthrift::ResultType646 fn result_type(&self) -> ::fbthrift::ResultType { 647 match self { 648 GetRandomDataExn::Success(_) => ::fbthrift::ResultType::Return, 649 GetRandomDataExn::ApplicationException(_aexn) => ::fbthrift::ResultType::Exception, 650 } 651 } 652 } 653 654 impl ::fbthrift::GetTType for GetRandomDataExn { 655 const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct; 656 } 657 658 impl<P> ::fbthrift::Serialize<P> for GetRandomDataExn 659 where 660 P: ::fbthrift::ProtocolWriter, 661 { write(&self, p: &mut P)662 fn write(&self, p: &mut P) { 663 if let GetRandomDataExn::ApplicationException(aexn) = self { 664 return aexn.write(p); 665 } 666 p.write_struct_begin("GetRandomData"); 667 match self { 668 GetRandomDataExn::Success(inner) => { 669 p.write_field_begin( 670 "Success", 671 ::fbthrift::TType::String, 672 0i16, 673 ); 674 inner.write(p); 675 p.write_field_end(); 676 } 677 GetRandomDataExn::ApplicationException(_aexn) => unreachable!(), 678 } 679 p.write_field_stop(); 680 p.write_struct_end(); 681 } 682 } 683 684 impl<P> ::fbthrift::Deserialize<P> for GetRandomDataExn 685 where 686 P: ::fbthrift::ProtocolReader, 687 { read(p: &mut P) -> ::anyhow::Result<Self>688 fn read(p: &mut P) -> ::anyhow::Result<Self> { 689 static RETURNS: &[::fbthrift::Field] = &[ 690 ::fbthrift::Field::new("Success", ::fbthrift::TType::String, 0), 691 ]; 692 let _ = p.read_struct_begin(|_| ())?; 693 let mut once = false; 694 let mut alt = ::std::option::Option::None; 695 loop { 696 let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?; 697 match ((fty, fid as ::std::primitive::i32), once) { 698 ((::fbthrift::TType::Stop, _), _) => { 699 p.read_field_end()?; 700 break; 701 } 702 ((::fbthrift::TType::String, 0i32), false) => { 703 once = true; 704 alt = ::std::option::Option::Some(GetRandomDataExn::Success(::fbthrift::Deserialize::read(p)?)); 705 } 706 ((ty, _id), false) => p.skip(ty)?, 707 ((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from( 708 ::fbthrift::ApplicationException::new( 709 ::fbthrift::ApplicationExceptionErrorCode::ProtocolError, 710 format!( 711 "unwanted extra union {} field ty {:?} id {}", 712 "GetRandomDataExn", 713 badty, 714 badid, 715 ), 716 ) 717 )), 718 } 719 p.read_field_end()?; 720 } 721 p.read_struct_end()?; 722 alt.ok_or_else(|| 723 ::fbthrift::ApplicationException::new( 724 ::fbthrift::ApplicationExceptionErrorCode::MissingResult, 725 format!("Empty union {}", "GetRandomDataExn"), 726 ) 727 .into(), 728 ) 729 } 730 } 731 732 #[derive(Clone, Debug)] 733 pub enum HasDataByIdExn { 734 Success(::std::primitive::bool), 735 ApplicationException(::fbthrift::ApplicationException), 736 } 737 738 impl ::std::convert::From<::fbthrift::ApplicationException> for HasDataByIdExn { from(exn: ::fbthrift::ApplicationException) -> Self739 fn from(exn: ::fbthrift::ApplicationException) -> Self { 740 HasDataByIdExn::ApplicationException(exn) 741 } 742 } 743 744 impl ::fbthrift::ExceptionInfo for HasDataByIdExn { exn_name(&self) -> &'static str745 fn exn_name(&self) -> &'static str { 746 match self { 747 HasDataByIdExn::Success(_) => panic!("ExceptionInfo::exn_name called on Success"), 748 HasDataByIdExn::ApplicationException(aexn) => aexn.exn_name(), 749 } 750 } 751 exn_value(&self) -> String752 fn exn_value(&self) -> String { 753 match self { 754 HasDataByIdExn::Success(_) => panic!("ExceptionInfo::exn_value called on Success"), 755 HasDataByIdExn::ApplicationException(aexn) => aexn.exn_value(), 756 } 757 } 758 exn_is_declared(&self) -> bool759 fn exn_is_declared(&self) -> bool { 760 match self { 761 HasDataByIdExn::Success(_) => panic!("ExceptionInfo::exn_is_declared called on Success"), 762 HasDataByIdExn::ApplicationException(aexn) => aexn.exn_is_declared(), 763 } 764 } 765 } 766 767 impl ::fbthrift::ResultInfo for HasDataByIdExn { result_type(&self) -> ::fbthrift::ResultType768 fn result_type(&self) -> ::fbthrift::ResultType { 769 match self { 770 HasDataByIdExn::Success(_) => ::fbthrift::ResultType::Return, 771 HasDataByIdExn::ApplicationException(_aexn) => ::fbthrift::ResultType::Exception, 772 } 773 } 774 } 775 776 impl ::fbthrift::GetTType for HasDataByIdExn { 777 const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct; 778 } 779 780 impl<P> ::fbthrift::Serialize<P> for HasDataByIdExn 781 where 782 P: ::fbthrift::ProtocolWriter, 783 { write(&self, p: &mut P)784 fn write(&self, p: &mut P) { 785 if let HasDataByIdExn::ApplicationException(aexn) = self { 786 return aexn.write(p); 787 } 788 p.write_struct_begin("HasDataById"); 789 match self { 790 HasDataByIdExn::Success(inner) => { 791 p.write_field_begin( 792 "Success", 793 ::fbthrift::TType::Bool, 794 0i16, 795 ); 796 inner.write(p); 797 p.write_field_end(); 798 } 799 HasDataByIdExn::ApplicationException(_aexn) => unreachable!(), 800 } 801 p.write_field_stop(); 802 p.write_struct_end(); 803 } 804 } 805 806 impl<P> ::fbthrift::Deserialize<P> for HasDataByIdExn 807 where 808 P: ::fbthrift::ProtocolReader, 809 { read(p: &mut P) -> ::anyhow::Result<Self>810 fn read(p: &mut P) -> ::anyhow::Result<Self> { 811 static RETURNS: &[::fbthrift::Field] = &[ 812 ::fbthrift::Field::new("Success", ::fbthrift::TType::Bool, 0), 813 ]; 814 let _ = p.read_struct_begin(|_| ())?; 815 let mut once = false; 816 let mut alt = ::std::option::Option::None; 817 loop { 818 let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?; 819 match ((fty, fid as ::std::primitive::i32), once) { 820 ((::fbthrift::TType::Stop, _), _) => { 821 p.read_field_end()?; 822 break; 823 } 824 ((::fbthrift::TType::Bool, 0i32), false) => { 825 once = true; 826 alt = ::std::option::Option::Some(HasDataByIdExn::Success(::fbthrift::Deserialize::read(p)?)); 827 } 828 ((ty, _id), false) => p.skip(ty)?, 829 ((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from( 830 ::fbthrift::ApplicationException::new( 831 ::fbthrift::ApplicationExceptionErrorCode::ProtocolError, 832 format!( 833 "unwanted extra union {} field ty {:?} id {}", 834 "HasDataByIdExn", 835 badty, 836 badid, 837 ), 838 ) 839 )), 840 } 841 p.read_field_end()?; 842 } 843 p.read_struct_end()?; 844 alt.ok_or_else(|| 845 ::fbthrift::ApplicationException::new( 846 ::fbthrift::ApplicationExceptionErrorCode::MissingResult, 847 format!("Empty union {}", "HasDataByIdExn"), 848 ) 849 .into(), 850 ) 851 } 852 } 853 854 #[derive(Clone, Debug)] 855 pub enum GetDataByIdExn { 856 Success(::std::string::String), 857 ApplicationException(::fbthrift::ApplicationException), 858 } 859 860 impl ::std::convert::From<::fbthrift::ApplicationException> for GetDataByIdExn { from(exn: ::fbthrift::ApplicationException) -> Self861 fn from(exn: ::fbthrift::ApplicationException) -> Self { 862 GetDataByIdExn::ApplicationException(exn) 863 } 864 } 865 866 impl ::fbthrift::ExceptionInfo for GetDataByIdExn { exn_name(&self) -> &'static str867 fn exn_name(&self) -> &'static str { 868 match self { 869 GetDataByIdExn::Success(_) => panic!("ExceptionInfo::exn_name called on Success"), 870 GetDataByIdExn::ApplicationException(aexn) => aexn.exn_name(), 871 } 872 } 873 exn_value(&self) -> String874 fn exn_value(&self) -> String { 875 match self { 876 GetDataByIdExn::Success(_) => panic!("ExceptionInfo::exn_value called on Success"), 877 GetDataByIdExn::ApplicationException(aexn) => aexn.exn_value(), 878 } 879 } 880 exn_is_declared(&self) -> bool881 fn exn_is_declared(&self) -> bool { 882 match self { 883 GetDataByIdExn::Success(_) => panic!("ExceptionInfo::exn_is_declared called on Success"), 884 GetDataByIdExn::ApplicationException(aexn) => aexn.exn_is_declared(), 885 } 886 } 887 } 888 889 impl ::fbthrift::ResultInfo for GetDataByIdExn { result_type(&self) -> ::fbthrift::ResultType890 fn result_type(&self) -> ::fbthrift::ResultType { 891 match self { 892 GetDataByIdExn::Success(_) => ::fbthrift::ResultType::Return, 893 GetDataByIdExn::ApplicationException(_aexn) => ::fbthrift::ResultType::Exception, 894 } 895 } 896 } 897 898 impl ::fbthrift::GetTType for GetDataByIdExn { 899 const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct; 900 } 901 902 impl<P> ::fbthrift::Serialize<P> for GetDataByIdExn 903 where 904 P: ::fbthrift::ProtocolWriter, 905 { write(&self, p: &mut P)906 fn write(&self, p: &mut P) { 907 if let GetDataByIdExn::ApplicationException(aexn) = self { 908 return aexn.write(p); 909 } 910 p.write_struct_begin("GetDataById"); 911 match self { 912 GetDataByIdExn::Success(inner) => { 913 p.write_field_begin( 914 "Success", 915 ::fbthrift::TType::String, 916 0i16, 917 ); 918 inner.write(p); 919 p.write_field_end(); 920 } 921 GetDataByIdExn::ApplicationException(_aexn) => unreachable!(), 922 } 923 p.write_field_stop(); 924 p.write_struct_end(); 925 } 926 } 927 928 impl<P> ::fbthrift::Deserialize<P> for GetDataByIdExn 929 where 930 P: ::fbthrift::ProtocolReader, 931 { read(p: &mut P) -> ::anyhow::Result<Self>932 fn read(p: &mut P) -> ::anyhow::Result<Self> { 933 static RETURNS: &[::fbthrift::Field] = &[ 934 ::fbthrift::Field::new("Success", ::fbthrift::TType::String, 0), 935 ]; 936 let _ = p.read_struct_begin(|_| ())?; 937 let mut once = false; 938 let mut alt = ::std::option::Option::None; 939 loop { 940 let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?; 941 match ((fty, fid as ::std::primitive::i32), once) { 942 ((::fbthrift::TType::Stop, _), _) => { 943 p.read_field_end()?; 944 break; 945 } 946 ((::fbthrift::TType::String, 0i32), false) => { 947 once = true; 948 alt = ::std::option::Option::Some(GetDataByIdExn::Success(::fbthrift::Deserialize::read(p)?)); 949 } 950 ((ty, _id), false) => p.skip(ty)?, 951 ((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from( 952 ::fbthrift::ApplicationException::new( 953 ::fbthrift::ApplicationExceptionErrorCode::ProtocolError, 954 format!( 955 "unwanted extra union {} field ty {:?} id {}", 956 "GetDataByIdExn", 957 badty, 958 badid, 959 ), 960 ) 961 )), 962 } 963 p.read_field_end()?; 964 } 965 p.read_struct_end()?; 966 alt.ok_or_else(|| 967 ::fbthrift::ApplicationException::new( 968 ::fbthrift::ApplicationExceptionErrorCode::MissingResult, 969 format!("Empty union {}", "GetDataByIdExn"), 970 ) 971 .into(), 972 ) 973 } 974 } 975 976 #[derive(Clone, Debug)] 977 pub enum PutDataByIdExn { 978 Success(()), 979 ApplicationException(::fbthrift::ApplicationException), 980 } 981 982 impl ::std::convert::From<::fbthrift::ApplicationException> for PutDataByIdExn { from(exn: ::fbthrift::ApplicationException) -> Self983 fn from(exn: ::fbthrift::ApplicationException) -> Self { 984 PutDataByIdExn::ApplicationException(exn) 985 } 986 } 987 988 impl ::fbthrift::ExceptionInfo for PutDataByIdExn { exn_name(&self) -> &'static str989 fn exn_name(&self) -> &'static str { 990 match self { 991 PutDataByIdExn::Success(_) => panic!("ExceptionInfo::exn_name called on Success"), 992 PutDataByIdExn::ApplicationException(aexn) => aexn.exn_name(), 993 } 994 } 995 exn_value(&self) -> String996 fn exn_value(&self) -> String { 997 match self { 998 PutDataByIdExn::Success(_) => panic!("ExceptionInfo::exn_value called on Success"), 999 PutDataByIdExn::ApplicationException(aexn) => aexn.exn_value(), 1000 } 1001 } 1002 exn_is_declared(&self) -> bool1003 fn exn_is_declared(&self) -> bool { 1004 match self { 1005 PutDataByIdExn::Success(_) => panic!("ExceptionInfo::exn_is_declared called on Success"), 1006 PutDataByIdExn::ApplicationException(aexn) => aexn.exn_is_declared(), 1007 } 1008 } 1009 } 1010 1011 impl ::fbthrift::ResultInfo for PutDataByIdExn { result_type(&self) -> ::fbthrift::ResultType1012 fn result_type(&self) -> ::fbthrift::ResultType { 1013 match self { 1014 PutDataByIdExn::Success(_) => ::fbthrift::ResultType::Return, 1015 PutDataByIdExn::ApplicationException(_aexn) => ::fbthrift::ResultType::Exception, 1016 } 1017 } 1018 } 1019 1020 impl ::fbthrift::GetTType for PutDataByIdExn { 1021 const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct; 1022 } 1023 1024 impl<P> ::fbthrift::Serialize<P> for PutDataByIdExn 1025 where 1026 P: ::fbthrift::ProtocolWriter, 1027 { write(&self, p: &mut P)1028 fn write(&self, p: &mut P) { 1029 if let PutDataByIdExn::ApplicationException(aexn) = self { 1030 return aexn.write(p); 1031 } 1032 p.write_struct_begin("PutDataById"); 1033 match self { 1034 PutDataByIdExn::Success(inner) => { 1035 p.write_field_begin( 1036 "Success", 1037 ::fbthrift::TType::Void, 1038 0i16, 1039 ); 1040 inner.write(p); 1041 p.write_field_end(); 1042 } 1043 PutDataByIdExn::ApplicationException(_aexn) => unreachable!(), 1044 } 1045 p.write_field_stop(); 1046 p.write_struct_end(); 1047 } 1048 } 1049 1050 impl<P> ::fbthrift::Deserialize<P> for PutDataByIdExn 1051 where 1052 P: ::fbthrift::ProtocolReader, 1053 { read(p: &mut P) -> ::anyhow::Result<Self>1054 fn read(p: &mut P) -> ::anyhow::Result<Self> { 1055 static RETURNS: &[::fbthrift::Field] = &[ 1056 ::fbthrift::Field::new("Success", ::fbthrift::TType::Void, 0), 1057 ]; 1058 let _ = p.read_struct_begin(|_| ())?; 1059 let mut once = false; 1060 let mut alt = PutDataByIdExn::Success(()); 1061 loop { 1062 let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?; 1063 match ((fty, fid as ::std::primitive::i32), once) { 1064 ((::fbthrift::TType::Stop, _), _) => { 1065 p.read_field_end()?; 1066 break; 1067 } 1068 ((::fbthrift::TType::Void, 0i32), false) => { 1069 once = true; 1070 alt = PutDataByIdExn::Success(::fbthrift::Deserialize::read(p)?); 1071 } 1072 ((ty, _id), false) => p.skip(ty)?, 1073 ((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from( 1074 ::fbthrift::ApplicationException::new( 1075 ::fbthrift::ApplicationExceptionErrorCode::ProtocolError, 1076 format!( 1077 "unwanted extra union {} field ty {:?} id {}", 1078 "PutDataByIdExn", 1079 badty, 1080 badid, 1081 ), 1082 ) 1083 )), 1084 } 1085 p.read_field_end()?; 1086 } 1087 p.read_struct_end()?; 1088 ::std::result::Result::Ok(alt) 1089 } 1090 } 1091 1092 #[derive(Clone, Debug)] 1093 pub enum LobDataByIdExn { 1094 Success(()), 1095 ApplicationException(::fbthrift::ApplicationException), 1096 } 1097 1098 impl ::std::convert::From<::fbthrift::ApplicationException> for LobDataByIdExn { from(exn: ::fbthrift::ApplicationException) -> Self1099 fn from(exn: ::fbthrift::ApplicationException) -> Self { 1100 LobDataByIdExn::ApplicationException(exn) 1101 } 1102 } 1103 1104 impl ::fbthrift::ExceptionInfo for LobDataByIdExn { exn_name(&self) -> &'static str1105 fn exn_name(&self) -> &'static str { 1106 match self { 1107 LobDataByIdExn::Success(_) => panic!("ExceptionInfo::exn_name called on Success"), 1108 LobDataByIdExn::ApplicationException(aexn) => aexn.exn_name(), 1109 } 1110 } 1111 exn_value(&self) -> String1112 fn exn_value(&self) -> String { 1113 match self { 1114 LobDataByIdExn::Success(_) => panic!("ExceptionInfo::exn_value called on Success"), 1115 LobDataByIdExn::ApplicationException(aexn) => aexn.exn_value(), 1116 } 1117 } 1118 exn_is_declared(&self) -> bool1119 fn exn_is_declared(&self) -> bool { 1120 match self { 1121 LobDataByIdExn::Success(_) => panic!("ExceptionInfo::exn_is_declared called on Success"), 1122 LobDataByIdExn::ApplicationException(aexn) => aexn.exn_is_declared(), 1123 } 1124 } 1125 } 1126 1127 impl ::fbthrift::ResultInfo for LobDataByIdExn { result_type(&self) -> ::fbthrift::ResultType1128 fn result_type(&self) -> ::fbthrift::ResultType { 1129 match self { 1130 LobDataByIdExn::Success(_) => ::fbthrift::ResultType::Return, 1131 LobDataByIdExn::ApplicationException(_aexn) => ::fbthrift::ResultType::Exception, 1132 } 1133 } 1134 } 1135 1136 impl ::fbthrift::GetTType for LobDataByIdExn { 1137 const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct; 1138 } 1139 1140 impl<P> ::fbthrift::Serialize<P> for LobDataByIdExn 1141 where 1142 P: ::fbthrift::ProtocolWriter, 1143 { write(&self, p: &mut P)1144 fn write(&self, p: &mut P) { 1145 if let LobDataByIdExn::ApplicationException(aexn) = self { 1146 return aexn.write(p); 1147 } 1148 p.write_struct_begin("LobDataById"); 1149 match self { 1150 LobDataByIdExn::Success(inner) => { 1151 p.write_field_begin( 1152 "Success", 1153 ::fbthrift::TType::Void, 1154 0i16, 1155 ); 1156 inner.write(p); 1157 p.write_field_end(); 1158 } 1159 LobDataByIdExn::ApplicationException(_aexn) => unreachable!(), 1160 } 1161 p.write_field_stop(); 1162 p.write_struct_end(); 1163 } 1164 } 1165 1166 impl<P> ::fbthrift::Deserialize<P> for LobDataByIdExn 1167 where 1168 P: ::fbthrift::ProtocolReader, 1169 { read(p: &mut P) -> ::anyhow::Result<Self>1170 fn read(p: &mut P) -> ::anyhow::Result<Self> { 1171 static RETURNS: &[::fbthrift::Field] = &[ 1172 ::fbthrift::Field::new("Success", ::fbthrift::TType::Void, 0), 1173 ]; 1174 let _ = p.read_struct_begin(|_| ())?; 1175 let mut once = false; 1176 let mut alt = LobDataByIdExn::Success(()); 1177 loop { 1178 let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?; 1179 match ((fty, fid as ::std::primitive::i32), once) { 1180 ((::fbthrift::TType::Stop, _), _) => { 1181 p.read_field_end()?; 1182 break; 1183 } 1184 ((::fbthrift::TType::Void, 0i32), false) => { 1185 once = true; 1186 alt = LobDataByIdExn::Success(::fbthrift::Deserialize::read(p)?); 1187 } 1188 ((ty, _id), false) => p.skip(ty)?, 1189 ((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from( 1190 ::fbthrift::ApplicationException::new( 1191 ::fbthrift::ApplicationExceptionErrorCode::ProtocolError, 1192 format!( 1193 "unwanted extra union {} field ty {:?} id {}", 1194 "LobDataByIdExn", 1195 badty, 1196 badid, 1197 ), 1198 ) 1199 )), 1200 } 1201 p.read_field_end()?; 1202 } 1203 p.read_struct_end()?; 1204 ::std::result::Result::Ok(alt) 1205 } 1206 } 1207 #[derive(Clone, Debug)] 1208 pub enum StreamByIdStreamExn { 1209 Success(crate::types::MyStruct), 1210 ApplicationException(::fbthrift::ApplicationException), 1211 } 1212 1213 impl ::std::convert::From<::fbthrift::ApplicationException> for StreamByIdStreamExn { from(exn: ::fbthrift::ApplicationException) -> Self1214 fn from(exn: ::fbthrift::ApplicationException) -> Self { 1215 StreamByIdStreamExn::ApplicationException(exn) 1216 } 1217 } 1218 1219 impl ::fbthrift::GetTType for StreamByIdStreamExn { 1220 const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct; 1221 } 1222 1223 impl<P> ::fbthrift::Serialize<P> for StreamByIdStreamExn 1224 where 1225 P: ::fbthrift::ProtocolWriter, 1226 { write(&self, p: &mut P)1227 fn write(&self, p: &mut P) { 1228 p.write_struct_begin("StreamById"); 1229 match self { 1230 StreamByIdStreamExn::Success(inner) => { 1231 p.write_field_begin( 1232 "Success", 1233 ::fbthrift::TType::Stream, 1234 0i16, 1235 ); 1236 inner.write(p); 1237 p.write_field_end(); 1238 } 1239 StreamByIdStreamExn::ApplicationException(_) => panic!( 1240 "Bad union Alt field {} id {}", 1241 "ApplicationException", 1242 -2147483648i32, 1243 ), 1244 } 1245 p.write_field_stop(); 1246 p.write_struct_end(); 1247 } 1248 } 1249 1250 impl<P> ::fbthrift::Deserialize<P> for StreamByIdStreamExn 1251 where 1252 P: ::fbthrift::ProtocolReader, 1253 { read(p: &mut P) -> ::anyhow::Result<Self>1254 fn read(p: &mut P) -> ::anyhow::Result<Self> { 1255 static RETURNS: &[::fbthrift::Field] = &[ 1256 ::fbthrift::Field::new("Success", ::fbthrift::TType::Stream, 0), 1257 ]; 1258 let _ = p.read_struct_begin(|_| ())?; 1259 let mut once = false; 1260 let mut alt = ::std::option::Option::None; 1261 loop { 1262 let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?; 1263 match ((fty, fid as ::std::primitive::i32), once) { 1264 ((::fbthrift::TType::Stop, _), _) => { 1265 p.read_field_end()?; 1266 break; 1267 } 1268 ((::fbthrift::TType::Struct, 0i32), false) => { 1269 once = true; 1270 alt = ::std::option::Option::Some(StreamByIdStreamExn::Success(::fbthrift::Deserialize::read(p)?)); 1271 } 1272 ((ty, _id), false) => p.skip(ty)?, 1273 ((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from( 1274 ::fbthrift::ApplicationException::new( 1275 ::fbthrift::ApplicationExceptionErrorCode::ProtocolError, 1276 format!( 1277 "unwanted extra union {} field ty {:?} id {}", 1278 "StreamByIdStreamExn", 1279 badty, 1280 badid, 1281 ), 1282 ) 1283 )), 1284 } 1285 p.read_field_end()?; 1286 } 1287 p.read_struct_end()?; 1288 alt.ok_or_else(|| 1289 ::fbthrift::ApplicationException::new( 1290 ::fbthrift::ApplicationExceptionErrorCode::MissingResult, 1291 format!("Empty union {}", "StreamByIdStreamExn"), 1292 ) 1293 .into(), 1294 ) 1295 } 1296 } 1297 1298 #[derive(Clone, Debug)] 1299 pub enum StreamByIdWithExceptionStreamExn { 1300 Success(crate::types::MyStruct), 1301 e(crate::types::MyException), 1302 ApplicationException(::fbthrift::ApplicationException), 1303 } 1304 1305 impl ::fbthrift::ExceptionInfo for StreamByIdWithExceptionStreamExn { exn_name(&self) -> &'static str1306 fn exn_name(&self) -> &'static str { 1307 match self { 1308 StreamByIdWithExceptionStreamExn::Success(_) => panic!("ExceptionInfo::exn_name called on Success"), 1309 StreamByIdWithExceptionStreamExn::ApplicationException(aexn) => aexn.exn_name(), 1310 StreamByIdWithExceptionStreamExn::e(exn) => exn.exn_name(), 1311 } 1312 } 1313 exn_value(&self) -> String1314 fn exn_value(&self) -> String { 1315 match self { 1316 StreamByIdWithExceptionStreamExn::Success(_) => panic!("ExceptionInfo::exn_value called on Success"), 1317 StreamByIdWithExceptionStreamExn::ApplicationException(aexn) => aexn.exn_value(), 1318 StreamByIdWithExceptionStreamExn::e(exn) => exn.exn_value(), 1319 } 1320 } 1321 exn_is_declared(&self) -> bool1322 fn exn_is_declared(&self) -> bool { 1323 match self { 1324 StreamByIdWithExceptionStreamExn::Success(_) => panic!("ExceptionInfo::exn_is_declared called on Success"), 1325 StreamByIdWithExceptionStreamExn::ApplicationException(aexn) => aexn.exn_is_declared(), 1326 StreamByIdWithExceptionStreamExn::e(exn) => exn.exn_is_declared(), 1327 } 1328 } 1329 } 1330 1331 impl ::fbthrift::ResultInfo for StreamByIdWithExceptionStreamExn { result_type(&self) -> ::fbthrift::ResultType1332 fn result_type(&self) -> ::fbthrift::ResultType { 1333 match self { 1334 StreamByIdWithExceptionStreamExn::Success(_) => ::fbthrift::ResultType::Return, 1335 StreamByIdWithExceptionStreamExn::ApplicationException(_aexn) => ::fbthrift::ResultType::Exception, 1336 } 1337 } 1338 } 1339 1340 impl ::std::convert::From<crate::types::MyException> for StreamByIdWithExceptionStreamExn { from(exn: crate::types::MyException) -> Self1341 fn from(exn: crate::types::MyException) -> Self { 1342 StreamByIdWithExceptionStreamExn::e(exn) 1343 } 1344 } 1345 1346 impl ::std::convert::From<::fbthrift::ApplicationException> for StreamByIdWithExceptionStreamExn { from(exn: ::fbthrift::ApplicationException) -> Self1347 fn from(exn: ::fbthrift::ApplicationException) -> Self { 1348 StreamByIdWithExceptionStreamExn::ApplicationException(exn) 1349 } 1350 } 1351 1352 impl ::fbthrift::GetTType for StreamByIdWithExceptionStreamExn { 1353 const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct; 1354 } 1355 1356 impl<P> ::fbthrift::Serialize<P> for StreamByIdWithExceptionStreamExn 1357 where 1358 P: ::fbthrift::ProtocolWriter, 1359 { write(&self, p: &mut P)1360 fn write(&self, p: &mut P) { 1361 p.write_struct_begin("StreamByIdWithException"); 1362 match self { 1363 StreamByIdWithExceptionStreamExn::Success(inner) => { 1364 p.write_field_begin( 1365 "Success", 1366 ::fbthrift::TType::Stream, 1367 0i16, 1368 ); 1369 inner.write(p); 1370 p.write_field_end(); 1371 } 1372 StreamByIdWithExceptionStreamExn::e(inner) => { 1373 p.write_field_begin( 1374 "e", 1375 ::fbthrift::TType::Struct, 1376 1, 1377 ); 1378 inner.write(p); 1379 p.write_field_end(); 1380 } 1381 StreamByIdWithExceptionStreamExn::ApplicationException(_) => panic!( 1382 "Bad union Alt field {} id {}", 1383 "ApplicationException", 1384 -2147483648i32, 1385 ), 1386 } 1387 p.write_field_stop(); 1388 p.write_struct_end(); 1389 } 1390 } 1391 1392 impl<P> ::fbthrift::Deserialize<P> for StreamByIdWithExceptionStreamExn 1393 where 1394 P: ::fbthrift::ProtocolReader, 1395 { read(p: &mut P) -> ::anyhow::Result<Self>1396 fn read(p: &mut P) -> ::anyhow::Result<Self> { 1397 static RETURNS: &[::fbthrift::Field] = &[ 1398 ::fbthrift::Field::new("Success", ::fbthrift::TType::Stream, 0), 1399 ]; 1400 let _ = p.read_struct_begin(|_| ())?; 1401 let mut once = false; 1402 let mut alt = ::std::option::Option::None; 1403 loop { 1404 let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?; 1405 match ((fty, fid as ::std::primitive::i32), once) { 1406 ((::fbthrift::TType::Stop, _), _) => { 1407 p.read_field_end()?; 1408 break; 1409 } 1410 ((::fbthrift::TType::Struct, 0i32), false) => { 1411 once = true; 1412 alt = ::std::option::Option::Some(StreamByIdWithExceptionStreamExn::Success(::fbthrift::Deserialize::read(p)?)); 1413 } 1414 ((::fbthrift::TType::Struct, 1), false) => { 1415 once = true; 1416 alt = ::std::option::Option::Some(StreamByIdWithExceptionStreamExn::e(::fbthrift::Deserialize::read(p)?)); 1417 } 1418 ((ty, _id), false) => p.skip(ty)?, 1419 ((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from( 1420 ::fbthrift::ApplicationException::new( 1421 ::fbthrift::ApplicationExceptionErrorCode::ProtocolError, 1422 format!( 1423 "unwanted extra union {} field ty {:?} id {}", 1424 "StreamByIdWithExceptionStreamExn", 1425 badty, 1426 badid, 1427 ), 1428 ) 1429 )), 1430 } 1431 p.read_field_end()?; 1432 } 1433 p.read_struct_end()?; 1434 alt.ok_or_else(|| 1435 ::fbthrift::ApplicationException::new( 1436 ::fbthrift::ApplicationExceptionErrorCode::MissingResult, 1437 format!("Empty union {}", "StreamByIdWithExceptionStreamExn"), 1438 ) 1439 .into(), 1440 ) 1441 } 1442 } 1443 1444 #[derive(Clone, Debug)] 1445 pub enum StreamByIdWithResponseStreamExn { 1446 Success(crate::types::MyStruct), 1447 ApplicationException(::fbthrift::ApplicationException), 1448 } 1449 1450 impl ::std::convert::From<::fbthrift::ApplicationException> for StreamByIdWithResponseStreamExn { from(exn: ::fbthrift::ApplicationException) -> Self1451 fn from(exn: ::fbthrift::ApplicationException) -> Self { 1452 StreamByIdWithResponseStreamExn::ApplicationException(exn) 1453 } 1454 } 1455 1456 impl ::fbthrift::GetTType for StreamByIdWithResponseStreamExn { 1457 const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct; 1458 } 1459 1460 impl<P> ::fbthrift::Serialize<P> for StreamByIdWithResponseStreamExn 1461 where 1462 P: ::fbthrift::ProtocolWriter, 1463 { write(&self, p: &mut P)1464 fn write(&self, p: &mut P) { 1465 p.write_struct_begin("StreamByIdWithResponse"); 1466 match self { 1467 StreamByIdWithResponseStreamExn::Success(inner) => { 1468 p.write_field_begin( 1469 "Success", 1470 ::fbthrift::TType::Stream, 1471 0i16, 1472 ); 1473 inner.write(p); 1474 p.write_field_end(); 1475 } 1476 StreamByIdWithResponseStreamExn::ApplicationException(_) => panic!( 1477 "Bad union Alt field {} id {}", 1478 "ApplicationException", 1479 -2147483648i32, 1480 ), 1481 } 1482 p.write_field_stop(); 1483 p.write_struct_end(); 1484 } 1485 } 1486 1487 impl<P> ::fbthrift::Deserialize<P> for StreamByIdWithResponseStreamExn 1488 where 1489 P: ::fbthrift::ProtocolReader, 1490 { read(p: &mut P) -> ::anyhow::Result<Self>1491 fn read(p: &mut P) -> ::anyhow::Result<Self> { 1492 static RETURNS: &[::fbthrift::Field] = &[ 1493 ::fbthrift::Field::new("Success", ::fbthrift::TType::Stream, 0), 1494 ]; 1495 let _ = p.read_struct_begin(|_| ())?; 1496 let mut once = false; 1497 let mut alt = ::std::option::Option::None; 1498 loop { 1499 let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?; 1500 match ((fty, fid as ::std::primitive::i32), once) { 1501 ((::fbthrift::TType::Stop, _), _) => { 1502 p.read_field_end()?; 1503 break; 1504 } 1505 ((::fbthrift::TType::Struct, 0i32), false) => { 1506 once = true; 1507 alt = ::std::option::Option::Some(StreamByIdWithResponseStreamExn::Success(::fbthrift::Deserialize::read(p)?)); 1508 } 1509 ((ty, _id), false) => p.skip(ty)?, 1510 ((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from( 1511 ::fbthrift::ApplicationException::new( 1512 ::fbthrift::ApplicationExceptionErrorCode::ProtocolError, 1513 format!( 1514 "unwanted extra union {} field ty {:?} id {}", 1515 "StreamByIdWithResponseStreamExn", 1516 badty, 1517 badid, 1518 ), 1519 ) 1520 )), 1521 } 1522 p.read_field_end()?; 1523 } 1524 p.read_struct_end()?; 1525 alt.ok_or_else(|| 1526 ::fbthrift::ApplicationException::new( 1527 ::fbthrift::ApplicationExceptionErrorCode::MissingResult, 1528 format!("Empty union {}", "StreamByIdWithResponseStreamExn"), 1529 ) 1530 .into(), 1531 ) 1532 } 1533 } 1534 #[derive(Clone, Debug)] 1535 pub enum StreamByIdWithResponseExn { 1536 Success(crate::types::MyDataItem), 1537 ApplicationException(::fbthrift::ApplicationException), 1538 } 1539 1540 impl ::std::convert::From<::fbthrift::ApplicationException> for StreamByIdWithResponseExn { from(exn: ::fbthrift::ApplicationException) -> Self1541 fn from(exn: ::fbthrift::ApplicationException) -> Self { 1542 StreamByIdWithResponseExn::ApplicationException(exn) 1543 } 1544 } 1545 1546 impl ::fbthrift::GetTType for StreamByIdWithResponseExn { 1547 const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct; 1548 } 1549 1550 impl<P> ::fbthrift::Serialize<P> for StreamByIdWithResponseExn 1551 where 1552 P: ::fbthrift::ProtocolWriter, 1553 { write(&self, p: &mut P)1554 fn write(&self, p: &mut P) { 1555 p.write_struct_begin("StreamByIdWithResponse"); 1556 match self { 1557 StreamByIdWithResponseExn::Success(inner) => { 1558 p.write_field_begin( 1559 "Success", 1560 ::fbthrift::TType::Struct, 1561 0i16, 1562 ); 1563 inner.write(p); 1564 p.write_field_end(); 1565 } 1566 StreamByIdWithResponseExn::ApplicationException(_) => panic!( 1567 "Bad union Alt field {} id {}", 1568 "ApplicationException", 1569 -2147483648i32, 1570 ), 1571 } 1572 p.write_field_stop(); 1573 p.write_struct_end(); 1574 } 1575 } 1576 1577 impl<P> ::fbthrift::Deserialize<P> for StreamByIdWithResponseExn 1578 where 1579 P: ::fbthrift::ProtocolReader, 1580 { read(p: &mut P) -> ::anyhow::Result<Self>1581 fn read(p: &mut P) -> ::anyhow::Result<Self> { 1582 static RETURNS: &[::fbthrift::Field] = &[ 1583 ::fbthrift::Field::new("Success", ::fbthrift::TType::Stream, 0), 1584 ]; 1585 let _ = p.read_struct_begin(|_| ())?; 1586 let mut once = false; 1587 let mut alt = ::std::option::Option::None; 1588 loop { 1589 let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?; 1590 match ((fty, fid as ::std::primitive::i32), once) { 1591 ((::fbthrift::TType::Stop, _), _) => { 1592 p.read_field_end()?; 1593 break; 1594 } 1595 ((::fbthrift::TType::Struct, 0i32), false) => { 1596 once = true; 1597 alt = ::std::option::Option::Some(StreamByIdWithResponseExn::Success(::fbthrift::Deserialize::read(p)?)); 1598 } 1599 ((ty, _id), false) => p.skip(ty)?, 1600 ((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from( 1601 ::fbthrift::ApplicationException::new( 1602 ::fbthrift::ApplicationExceptionErrorCode::ProtocolError, 1603 format!( 1604 "unwanted extra union {} field ty {:?} id {}", 1605 "StreamByIdWithResponseExn", 1606 badty, 1607 badid, 1608 ), 1609 ) 1610 )), 1611 } 1612 p.read_field_end()?; 1613 } 1614 p.read_struct_end()?; 1615 alt.ok_or_else(|| 1616 ::fbthrift::ApplicationException::new( 1617 ::fbthrift::ApplicationExceptionErrorCode::MissingResult, 1618 format!("Empty union {}", "StreamByIdWithResponseExn"), 1619 ) 1620 .into(), 1621 ) 1622 } 1623 } 1624 1625 } 1626 } 1627 1628 /// Client implementation for each service in `module`. 1629 pub mod client { 1630 1631 pub struct MyServiceImpl<P, T, S = ::fbthrift::NoopSpawner> { 1632 transport: T, 1633 _phantom: ::std::marker::PhantomData<fn() -> (P, S)>, 1634 } 1635 1636 impl<P, T, S> MyServiceImpl<P, T, S> { new( transport: T, ) -> Self1637 pub fn new( 1638 transport: T, 1639 ) -> Self { 1640 Self { 1641 transport, 1642 _phantom: ::std::marker::PhantomData, 1643 } 1644 } 1645 transport(&self) -> &T1646 pub fn transport(&self) -> &T { 1647 &self.transport 1648 } 1649 } 1650 1651 pub trait MyService: ::std::marker::Send { ping( &self, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(), crate::errors::my_service::PingError>> + ::std::marker::Send + 'static>>1652 fn ping( 1653 &self, 1654 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(), crate::errors::my_service::PingError>> + ::std::marker::Send + 'static>>; getRandomData( &self, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::string::String, crate::errors::my_service::GetRandomDataError>> + ::std::marker::Send + 'static>>1655 fn getRandomData( 1656 &self, 1657 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::string::String, crate::errors::my_service::GetRandomDataError>> + ::std::marker::Send + 'static>>; hasDataById( &self, arg_id: ::std::primitive::i64, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::primitive::bool, crate::errors::my_service::HasDataByIdError>> + ::std::marker::Send + 'static>>1658 fn hasDataById( 1659 &self, 1660 arg_id: ::std::primitive::i64, 1661 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::primitive::bool, crate::errors::my_service::HasDataByIdError>> + ::std::marker::Send + 'static>>; getDataById( &self, arg_id: ::std::primitive::i64, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::string::String, crate::errors::my_service::GetDataByIdError>> + ::std::marker::Send + 'static>>1662 fn getDataById( 1663 &self, 1664 arg_id: ::std::primitive::i64, 1665 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::string::String, crate::errors::my_service::GetDataByIdError>> + ::std::marker::Send + 'static>>; putDataById( &self, arg_id: ::std::primitive::i64, arg_data: &::std::primitive::str, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(), crate::errors::my_service::PutDataByIdError>> + ::std::marker::Send + 'static>>1666 fn putDataById( 1667 &self, 1668 arg_id: ::std::primitive::i64, 1669 arg_data: &::std::primitive::str, 1670 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(), crate::errors::my_service::PutDataByIdError>> + ::std::marker::Send + 'static>>; lobDataById( &self, arg_id: ::std::primitive::i64, arg_data: &::std::primitive::str, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(), crate::errors::my_service::LobDataByIdError>> + ::std::marker::Send + 'static>>1671 fn lobDataById( 1672 &self, 1673 arg_id: ::std::primitive::i64, 1674 arg_data: &::std::primitive::str, 1675 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(), crate::errors::my_service::LobDataByIdError>> + ::std::marker::Send + 'static>>; streamById( &self, arg_id: ::std::primitive::i64, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdStreamError>> + ::std::marker::Send + 'static >>, crate::errors::my_service::StreamByIdError>> + ::std::marker::Send + 'static>>1676 fn streamById( 1677 &self, 1678 arg_id: ::std::primitive::i64, 1679 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdStreamError>> + ::std::marker::Send + 'static >>, crate::errors::my_service::StreamByIdError>> + ::std::marker::Send + 'static>>; streamByIdWithException( &self, arg_id: ::std::primitive::i64, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdWithExceptionStreamError>> + ::std::marker::Send + 'static >>, crate::errors::my_service::StreamByIdWithExceptionError>> + ::std::marker::Send + 'static>>1680 fn streamByIdWithException( 1681 &self, 1682 arg_id: ::std::primitive::i64, 1683 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdWithExceptionStreamError>> + ::std::marker::Send + 'static >>, crate::errors::my_service::StreamByIdWithExceptionError>> + ::std::marker::Send + 'static>>; streamByIdWithResponse( &self, arg_id: ::std::primitive::i64, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(crate::types::MyDataItem, ::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdWithResponseStreamError>> + ::std::marker::Send + 'static >>), crate::errors::my_service::StreamByIdWithResponseError>> + ::std::marker::Send + 'static>>1684 fn streamByIdWithResponse( 1685 &self, 1686 arg_id: ::std::primitive::i64, 1687 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(crate::types::MyDataItem, ::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdWithResponseStreamError>> + ::std::marker::Send + 'static >>), crate::errors::my_service::StreamByIdWithResponseError>> + ::std::marker::Send + 'static>>; 1688 } 1689 1690 struct Args_MyService_ping<'a> { 1691 _phantom: ::std::marker::PhantomData<&'a ()>, 1692 } 1693 1694 impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize<P> for self::Args_MyService_ping<'a> { 1695 #[inline] 1696 #[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "MyService.ping"))] write(&self, p: &mut P)1697 fn write(&self, p: &mut P) { 1698 p.write_struct_begin("args"); 1699 p.write_field_stop(); 1700 p.write_struct_end(); 1701 } 1702 } 1703 1704 struct Args_MyService_getRandomData<'a> { 1705 _phantom: ::std::marker::PhantomData<&'a ()>, 1706 } 1707 1708 impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize<P> for self::Args_MyService_getRandomData<'a> { 1709 #[inline] 1710 #[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "MyService.getRandomData"))] write(&self, p: &mut P)1711 fn write(&self, p: &mut P) { 1712 p.write_struct_begin("args"); 1713 p.write_field_stop(); 1714 p.write_struct_end(); 1715 } 1716 } 1717 1718 struct Args_MyService_hasDataById<'a> { 1719 id: ::std::primitive::i64, 1720 _phantom: ::std::marker::PhantomData<&'a ()>, 1721 } 1722 1723 impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize<P> for self::Args_MyService_hasDataById<'a> { 1724 #[inline] 1725 #[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "MyService.hasDataById"))] write(&self, p: &mut P)1726 fn write(&self, p: &mut P) { 1727 p.write_struct_begin("args"); 1728 p.write_field_begin("id", ::fbthrift::TType::I64, 1i16); 1729 ::fbthrift::Serialize::write(&self.id, p); 1730 p.write_field_end(); 1731 p.write_field_stop(); 1732 p.write_struct_end(); 1733 } 1734 } 1735 1736 struct Args_MyService_getDataById<'a> { 1737 id: ::std::primitive::i64, 1738 _phantom: ::std::marker::PhantomData<&'a ()>, 1739 } 1740 1741 impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize<P> for self::Args_MyService_getDataById<'a> { 1742 #[inline] 1743 #[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "MyService.getDataById"))] write(&self, p: &mut P)1744 fn write(&self, p: &mut P) { 1745 p.write_struct_begin("args"); 1746 p.write_field_begin("id", ::fbthrift::TType::I64, 1i16); 1747 ::fbthrift::Serialize::write(&self.id, p); 1748 p.write_field_end(); 1749 p.write_field_stop(); 1750 p.write_struct_end(); 1751 } 1752 } 1753 1754 struct Args_MyService_putDataById<'a> { 1755 id: ::std::primitive::i64, 1756 data: &'a ::std::primitive::str, 1757 _phantom: ::std::marker::PhantomData<&'a ()>, 1758 } 1759 1760 impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize<P> for self::Args_MyService_putDataById<'a> { 1761 #[inline] 1762 #[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "MyService.putDataById"))] write(&self, p: &mut P)1763 fn write(&self, p: &mut P) { 1764 p.write_struct_begin("args"); 1765 p.write_field_begin("id", ::fbthrift::TType::I64, 1i16); 1766 ::fbthrift::Serialize::write(&self.id, p); 1767 p.write_field_end(); 1768 p.write_field_begin("data", ::fbthrift::TType::String, 2i16); 1769 ::fbthrift::Serialize::write(&self.data, p); 1770 p.write_field_end(); 1771 p.write_field_stop(); 1772 p.write_struct_end(); 1773 } 1774 } 1775 1776 struct Args_MyService_lobDataById<'a> { 1777 id: ::std::primitive::i64, 1778 data: &'a ::std::primitive::str, 1779 _phantom: ::std::marker::PhantomData<&'a ()>, 1780 } 1781 1782 impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize<P> for self::Args_MyService_lobDataById<'a> { 1783 #[inline] 1784 #[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "MyService.lobDataById"))] write(&self, p: &mut P)1785 fn write(&self, p: &mut P) { 1786 p.write_struct_begin("args"); 1787 p.write_field_begin("id", ::fbthrift::TType::I64, 1i16); 1788 ::fbthrift::Serialize::write(&self.id, p); 1789 p.write_field_end(); 1790 p.write_field_begin("data", ::fbthrift::TType::String, 2i16); 1791 ::fbthrift::Serialize::write(&self.data, p); 1792 p.write_field_end(); 1793 p.write_field_stop(); 1794 p.write_struct_end(); 1795 } 1796 } 1797 1798 struct Args_MyService_streamById<'a> { 1799 id: ::std::primitive::i64, 1800 _phantom: ::std::marker::PhantomData<&'a ()>, 1801 } 1802 1803 impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize<P> for self::Args_MyService_streamById<'a> { 1804 #[inline] 1805 #[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "MyService.streamById"))] write(&self, p: &mut P)1806 fn write(&self, p: &mut P) { 1807 p.write_struct_begin("args"); 1808 p.write_field_begin("id", ::fbthrift::TType::I64, 1i16); 1809 ::fbthrift::Serialize::write(&self.id, p); 1810 p.write_field_end(); 1811 p.write_field_stop(); 1812 p.write_struct_end(); 1813 } 1814 } 1815 1816 struct Args_MyService_streamByIdWithException<'a> { 1817 id: ::std::primitive::i64, 1818 _phantom: ::std::marker::PhantomData<&'a ()>, 1819 } 1820 1821 impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize<P> for self::Args_MyService_streamByIdWithException<'a> { 1822 #[inline] 1823 #[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "MyService.streamByIdWithException"))] write(&self, p: &mut P)1824 fn write(&self, p: &mut P) { 1825 p.write_struct_begin("args"); 1826 p.write_field_begin("id", ::fbthrift::TType::I64, 1i16); 1827 ::fbthrift::Serialize::write(&self.id, p); 1828 p.write_field_end(); 1829 p.write_field_stop(); 1830 p.write_struct_end(); 1831 } 1832 } 1833 1834 struct Args_MyService_streamByIdWithResponse<'a> { 1835 id: ::std::primitive::i64, 1836 _phantom: ::std::marker::PhantomData<&'a ()>, 1837 } 1838 1839 impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize<P> for self::Args_MyService_streamByIdWithResponse<'a> { 1840 #[inline] 1841 #[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "MyService.streamByIdWithResponse"))] write(&self, p: &mut P)1842 fn write(&self, p: &mut P) { 1843 p.write_struct_begin("args"); 1844 p.write_field_begin("id", ::fbthrift::TType::I64, 1i16); 1845 ::fbthrift::Serialize::write(&self.id, p); 1846 p.write_field_end(); 1847 p.write_field_stop(); 1848 p.write_struct_end(); 1849 } 1850 } 1851 1852 impl<P, T, S> MyService for MyServiceImpl<P, T, S> 1853 where 1854 P: ::fbthrift::Protocol, 1855 T: ::fbthrift::Transport, 1856 P::Frame: ::fbthrift::Framing<DecBuf = ::fbthrift::FramingDecoded<T>>, 1857 ::fbthrift::ProtocolEncoded<P>: ::fbthrift::BufMutExt<Final = ::fbthrift::FramingEncodedFinal<T>>, 1858 P::Deserializer: ::std::marker::Send, 1859 S: ::fbthrift::help::Spawner, 1860 { ping( &self, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(), crate::errors::my_service::PingError>> + ::std::marker::Send + 'static>>1861 fn ping( 1862 &self, 1863 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(), crate::errors::my_service::PingError>> + ::std::marker::Send + 'static>> { 1864 use ::const_cstr::const_cstr; 1865 use ::tracing::Instrument as _; 1866 use ::futures::FutureExt as _; 1867 1868 const_cstr! { 1869 SERVICE_NAME = "MyService"; 1870 METHOD_NAME = "MyService.ping"; 1871 } 1872 let args = self::Args_MyService_ping { 1873 _phantom: ::std::marker::PhantomData, 1874 }; 1875 1876 // need to do call setup outside of async block because T: Transport isn't Send 1877 let request_env = match ::fbthrift::help::serialize_request_envelope::<P, _>("ping", &args) { 1878 ::std::result::Result::Ok(res) => res, 1879 ::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(), 1880 }; 1881 1882 let call = self.transport() 1883 .call(SERVICE_NAME.as_cstr(), METHOD_NAME.as_cstr(), request_env) 1884 .instrument(::tracing::trace_span!("call", function = "MyService.ping")); 1885 1886 async move { 1887 let reply_env = call.await?; 1888 1889 let de = P::deserializer(reply_env); 1890 let (res, _de): (::std::result::Result<crate::services::my_service::PingExn, _>, _) = 1891 ::fbthrift::help::async_deserialize_response_envelope::<P, _, S>(de).await?; 1892 1893 match res { 1894 ::std::result::Result::Ok(exn) => ::std::convert::From::from(exn), 1895 ::std::result::Result::Err(aexn) => 1896 ::std::result::Result::Err(crate::errors::my_service::PingError::ApplicationException(aexn)) 1897 } 1898 } 1899 .instrument(::tracing::info_span!("MyService.ping")) 1900 .boxed() 1901 } 1902 1903 getRandomData( &self, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::string::String, crate::errors::my_service::GetRandomDataError>> + ::std::marker::Send + 'static>>1904 fn getRandomData( 1905 &self, 1906 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::string::String, crate::errors::my_service::GetRandomDataError>> + ::std::marker::Send + 'static>> { 1907 use ::const_cstr::const_cstr; 1908 use ::tracing::Instrument as _; 1909 use ::futures::FutureExt as _; 1910 1911 const_cstr! { 1912 SERVICE_NAME = "MyService"; 1913 METHOD_NAME = "MyService.getRandomData"; 1914 } 1915 let args = self::Args_MyService_getRandomData { 1916 _phantom: ::std::marker::PhantomData, 1917 }; 1918 1919 // need to do call setup outside of async block because T: Transport isn't Send 1920 let request_env = match ::fbthrift::help::serialize_request_envelope::<P, _>("getRandomData", &args) { 1921 ::std::result::Result::Ok(res) => res, 1922 ::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(), 1923 }; 1924 1925 let call = self.transport() 1926 .call(SERVICE_NAME.as_cstr(), METHOD_NAME.as_cstr(), request_env) 1927 .instrument(::tracing::trace_span!("call", function = "MyService.getRandomData")); 1928 1929 async move { 1930 let reply_env = call.await?; 1931 1932 let de = P::deserializer(reply_env); 1933 let (res, _de): (::std::result::Result<crate::services::my_service::GetRandomDataExn, _>, _) = 1934 ::fbthrift::help::async_deserialize_response_envelope::<P, _, S>(de).await?; 1935 1936 match res { 1937 ::std::result::Result::Ok(exn) => ::std::convert::From::from(exn), 1938 ::std::result::Result::Err(aexn) => 1939 ::std::result::Result::Err(crate::errors::my_service::GetRandomDataError::ApplicationException(aexn)) 1940 } 1941 } 1942 .instrument(::tracing::info_span!("MyService.getRandomData")) 1943 .boxed() 1944 } 1945 1946 hasDataById( &self, arg_id: ::std::primitive::i64, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::primitive::bool, crate::errors::my_service::HasDataByIdError>> + ::std::marker::Send + 'static>>1947 fn hasDataById( 1948 &self, 1949 arg_id: ::std::primitive::i64, 1950 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::primitive::bool, crate::errors::my_service::HasDataByIdError>> + ::std::marker::Send + 'static>> { 1951 use ::const_cstr::const_cstr; 1952 use ::tracing::Instrument as _; 1953 use ::futures::FutureExt as _; 1954 1955 const_cstr! { 1956 SERVICE_NAME = "MyService"; 1957 METHOD_NAME = "MyService.hasDataById"; 1958 } 1959 let args = self::Args_MyService_hasDataById { 1960 id: arg_id, 1961 _phantom: ::std::marker::PhantomData, 1962 }; 1963 1964 // need to do call setup outside of async block because T: Transport isn't Send 1965 let request_env = match ::fbthrift::help::serialize_request_envelope::<P, _>("hasDataById", &args) { 1966 ::std::result::Result::Ok(res) => res, 1967 ::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(), 1968 }; 1969 1970 let call = self.transport() 1971 .call(SERVICE_NAME.as_cstr(), METHOD_NAME.as_cstr(), request_env) 1972 .instrument(::tracing::trace_span!("call", function = "MyService.hasDataById")); 1973 1974 async move { 1975 let reply_env = call.await?; 1976 1977 let de = P::deserializer(reply_env); 1978 let (res, _de): (::std::result::Result<crate::services::my_service::HasDataByIdExn, _>, _) = 1979 ::fbthrift::help::async_deserialize_response_envelope::<P, _, S>(de).await?; 1980 1981 match res { 1982 ::std::result::Result::Ok(exn) => ::std::convert::From::from(exn), 1983 ::std::result::Result::Err(aexn) => 1984 ::std::result::Result::Err(crate::errors::my_service::HasDataByIdError::ApplicationException(aexn)) 1985 } 1986 } 1987 .instrument(::tracing::info_span!("MyService.hasDataById")) 1988 .boxed() 1989 } 1990 1991 getDataById( &self, arg_id: ::std::primitive::i64, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::string::String, crate::errors::my_service::GetDataByIdError>> + ::std::marker::Send + 'static>>1992 fn getDataById( 1993 &self, 1994 arg_id: ::std::primitive::i64, 1995 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::string::String, crate::errors::my_service::GetDataByIdError>> + ::std::marker::Send + 'static>> { 1996 use ::const_cstr::const_cstr; 1997 use ::tracing::Instrument as _; 1998 use ::futures::FutureExt as _; 1999 2000 const_cstr! { 2001 SERVICE_NAME = "MyService"; 2002 METHOD_NAME = "MyService.getDataById"; 2003 } 2004 let args = self::Args_MyService_getDataById { 2005 id: arg_id, 2006 _phantom: ::std::marker::PhantomData, 2007 }; 2008 2009 // need to do call setup outside of async block because T: Transport isn't Send 2010 let request_env = match ::fbthrift::help::serialize_request_envelope::<P, _>("getDataById", &args) { 2011 ::std::result::Result::Ok(res) => res, 2012 ::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(), 2013 }; 2014 2015 let call = self.transport() 2016 .call(SERVICE_NAME.as_cstr(), METHOD_NAME.as_cstr(), request_env) 2017 .instrument(::tracing::trace_span!("call", function = "MyService.getDataById")); 2018 2019 async move { 2020 let reply_env = call.await?; 2021 2022 let de = P::deserializer(reply_env); 2023 let (res, _de): (::std::result::Result<crate::services::my_service::GetDataByIdExn, _>, _) = 2024 ::fbthrift::help::async_deserialize_response_envelope::<P, _, S>(de).await?; 2025 2026 match res { 2027 ::std::result::Result::Ok(exn) => ::std::convert::From::from(exn), 2028 ::std::result::Result::Err(aexn) => 2029 ::std::result::Result::Err(crate::errors::my_service::GetDataByIdError::ApplicationException(aexn)) 2030 } 2031 } 2032 .instrument(::tracing::info_span!("MyService.getDataById")) 2033 .boxed() 2034 } 2035 2036 putDataById( &self, arg_id: ::std::primitive::i64, arg_data: &::std::primitive::str, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(), crate::errors::my_service::PutDataByIdError>> + ::std::marker::Send + 'static>>2037 fn putDataById( 2038 &self, 2039 arg_id: ::std::primitive::i64, 2040 arg_data: &::std::primitive::str, 2041 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(), crate::errors::my_service::PutDataByIdError>> + ::std::marker::Send + 'static>> { 2042 use ::const_cstr::const_cstr; 2043 use ::tracing::Instrument as _; 2044 use ::futures::FutureExt as _; 2045 2046 const_cstr! { 2047 SERVICE_NAME = "MyService"; 2048 METHOD_NAME = "MyService.putDataById"; 2049 } 2050 let args = self::Args_MyService_putDataById { 2051 id: arg_id, 2052 data: arg_data, 2053 _phantom: ::std::marker::PhantomData, 2054 }; 2055 2056 // need to do call setup outside of async block because T: Transport isn't Send 2057 let request_env = match ::fbthrift::help::serialize_request_envelope::<P, _>("putDataById", &args) { 2058 ::std::result::Result::Ok(res) => res, 2059 ::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(), 2060 }; 2061 2062 let call = self.transport() 2063 .call(SERVICE_NAME.as_cstr(), METHOD_NAME.as_cstr(), request_env) 2064 .instrument(::tracing::trace_span!("call", function = "MyService.putDataById")); 2065 2066 async move { 2067 let reply_env = call.await?; 2068 2069 let de = P::deserializer(reply_env); 2070 let (res, _de): (::std::result::Result<crate::services::my_service::PutDataByIdExn, _>, _) = 2071 ::fbthrift::help::async_deserialize_response_envelope::<P, _, S>(de).await?; 2072 2073 match res { 2074 ::std::result::Result::Ok(exn) => ::std::convert::From::from(exn), 2075 ::std::result::Result::Err(aexn) => 2076 ::std::result::Result::Err(crate::errors::my_service::PutDataByIdError::ApplicationException(aexn)) 2077 } 2078 } 2079 .instrument(::tracing::info_span!("MyService.putDataById")) 2080 .boxed() 2081 } 2082 2083 lobDataById( &self, arg_id: ::std::primitive::i64, arg_data: &::std::primitive::str, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(), crate::errors::my_service::LobDataByIdError>> + ::std::marker::Send + 'static>>2084 fn lobDataById( 2085 &self, 2086 arg_id: ::std::primitive::i64, 2087 arg_data: &::std::primitive::str, 2088 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(), crate::errors::my_service::LobDataByIdError>> + ::std::marker::Send + 'static>> { 2089 use ::const_cstr::const_cstr; 2090 use ::tracing::Instrument as _; 2091 use ::futures::FutureExt as _; 2092 2093 const_cstr! { 2094 SERVICE_NAME = "MyService"; 2095 METHOD_NAME = "MyService.lobDataById"; 2096 } 2097 let args = self::Args_MyService_lobDataById { 2098 id: arg_id, 2099 data: arg_data, 2100 _phantom: ::std::marker::PhantomData, 2101 }; 2102 2103 // need to do call setup outside of async block because T: Transport isn't Send 2104 let request_env = match ::fbthrift::help::serialize_request_envelope::<P, _>("lobDataById", &args) { 2105 ::std::result::Result::Ok(res) => res, 2106 ::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(), 2107 }; 2108 2109 let call = self.transport() 2110 .call(SERVICE_NAME.as_cstr(), METHOD_NAME.as_cstr(), request_env) 2111 .instrument(::tracing::trace_span!("call", function = "MyService.lobDataById")); 2112 2113 async move { 2114 let reply_env = call.await?; 2115 2116 let de = P::deserializer(reply_env); 2117 let (res, _de): (::std::result::Result<crate::services::my_service::LobDataByIdExn, _>, _) = 2118 ::fbthrift::help::async_deserialize_response_envelope::<P, _, S>(de).await?; 2119 2120 match res { 2121 ::std::result::Result::Ok(exn) => ::std::convert::From::from(exn), 2122 ::std::result::Result::Err(aexn) => 2123 ::std::result::Result::Err(crate::errors::my_service::LobDataByIdError::ApplicationException(aexn)) 2124 } 2125 } 2126 .instrument(::tracing::info_span!("MyService.lobDataById")) 2127 .boxed() 2128 } 2129 2130 2131 streamById( &self, arg_id: ::std::primitive::i64, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdStreamError>> + ::std::marker::Send + 'static >>, crate::errors::my_service::StreamByIdError>> + ::std::marker::Send + 'static>>2132 fn streamById( 2133 &self, 2134 arg_id: ::std::primitive::i64, 2135 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdStreamError>> + ::std::marker::Send + 'static >>, crate::errors::my_service::StreamByIdError>> + ::std::marker::Send + 'static>> { 2136 use ::const_cstr::const_cstr; 2137 use ::futures::future::FutureExt as _; 2138 use ::tracing::Instrument as _; 2139 use ::futures::StreamExt as _; 2140 use ::fbthrift::Deserialize as _; 2141 2142 const_cstr! { 2143 SERVICE_NAME = "MyService"; 2144 METHOD_NAME = "MyService.streamById"; 2145 } 2146 let args = self::Args_MyService_streamById { 2147 id: arg_id, 2148 _phantom: ::std::marker::PhantomData, 2149 }; 2150 2151 let request_env = match ::fbthrift::help::serialize_request_envelope::<P, _>("streamById", &args) { 2152 ::std::result::Result::Ok(res) => res, 2153 ::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(), 2154 }; 2155 2156 let call_stream = self.transport() 2157 .call_stream(SERVICE_NAME.as_cstr(), METHOD_NAME.as_cstr(), request_env) 2158 .instrument(::tracing::trace_span!("call_stream", method = "MyService.streamById")); 2159 2160 async move { 2161 let (_initial, stream) = call_stream.await?; 2162 2163 let new_stream = stream.then(|item_res| { 2164 async move { 2165 match item_res { 2166 ::std::result::Result::Err(err) => 2167 ::std::result::Result::Err(crate::errors::my_service::StreamByIdStreamError::from(err)), 2168 ::std::result::Result::Ok(item_enc) => { 2169 let res = S::spawn(move || { 2170 let mut de = P::deserializer(item_enc); 2171 crate::services::my_service::StreamByIdStreamExn::read(&mut de) 2172 }).await?; 2173 2174 let item: ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdStreamError> = 2175 ::std::convert::From::from(res); 2176 item 2177 } 2178 } 2179 } 2180 }) 2181 .boxed(); 2182 2183 ::std::result::Result::Ok(new_stream) 2184 } 2185 .instrument(::tracing::info_span!("MyService.streamById")) 2186 .boxed() 2187 } 2188 2189 streamByIdWithException( &self, arg_id: ::std::primitive::i64, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdWithExceptionStreamError>> + ::std::marker::Send + 'static >>, crate::errors::my_service::StreamByIdWithExceptionError>> + ::std::marker::Send + 'static>>2190 fn streamByIdWithException( 2191 &self, 2192 arg_id: ::std::primitive::i64, 2193 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdWithExceptionStreamError>> + ::std::marker::Send + 'static >>, crate::errors::my_service::StreamByIdWithExceptionError>> + ::std::marker::Send + 'static>> { 2194 use ::const_cstr::const_cstr; 2195 use ::futures::future::FutureExt as _; 2196 use ::tracing::Instrument as _; 2197 use ::futures::StreamExt as _; 2198 use ::fbthrift::Deserialize as _; 2199 2200 const_cstr! { 2201 SERVICE_NAME = "MyService"; 2202 METHOD_NAME = "MyService.streamByIdWithException"; 2203 } 2204 let args = self::Args_MyService_streamByIdWithException { 2205 id: arg_id, 2206 _phantom: ::std::marker::PhantomData, 2207 }; 2208 2209 let request_env = match ::fbthrift::help::serialize_request_envelope::<P, _>("streamByIdWithException", &args) { 2210 ::std::result::Result::Ok(res) => res, 2211 ::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(), 2212 }; 2213 2214 let call_stream = self.transport() 2215 .call_stream(SERVICE_NAME.as_cstr(), METHOD_NAME.as_cstr(), request_env) 2216 .instrument(::tracing::trace_span!("call_stream", method = "MyService.streamByIdWithException")); 2217 2218 async move { 2219 let (_initial, stream) = call_stream.await?; 2220 2221 let new_stream = stream.then(|item_res| { 2222 async move { 2223 match item_res { 2224 ::std::result::Result::Err(err) => 2225 ::std::result::Result::Err(crate::errors::my_service::StreamByIdWithExceptionStreamError::from(err)), 2226 ::std::result::Result::Ok(item_enc) => { 2227 let res = S::spawn(move || { 2228 let mut de = P::deserializer(item_enc); 2229 crate::services::my_service::StreamByIdWithExceptionStreamExn::read(&mut de) 2230 }).await?; 2231 2232 let item: ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdWithExceptionStreamError> = 2233 ::std::convert::From::from(res); 2234 item 2235 } 2236 } 2237 } 2238 }) 2239 .boxed(); 2240 2241 ::std::result::Result::Ok(new_stream) 2242 } 2243 .instrument(::tracing::info_span!("MyService.streamByIdWithException")) 2244 .boxed() 2245 } 2246 2247 streamByIdWithResponse( &self, arg_id: ::std::primitive::i64, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(crate::types::MyDataItem, ::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdWithResponseStreamError>> + ::std::marker::Send + 'static >>), crate::errors::my_service::StreamByIdWithResponseError>> + ::std::marker::Send + 'static>>2248 fn streamByIdWithResponse( 2249 &self, 2250 arg_id: ::std::primitive::i64, 2251 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(crate::types::MyDataItem, ::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdWithResponseStreamError>> + ::std::marker::Send + 'static >>), crate::errors::my_service::StreamByIdWithResponseError>> + ::std::marker::Send + 'static>> { 2252 use ::const_cstr::const_cstr; 2253 use ::futures::future::FutureExt as _; 2254 use ::tracing::Instrument as _; 2255 use ::futures::StreamExt as _; 2256 use ::fbthrift::Deserialize as _; 2257 2258 const_cstr! { 2259 SERVICE_NAME = "MyService"; 2260 METHOD_NAME = "MyService.streamByIdWithResponse"; 2261 } 2262 let args = self::Args_MyService_streamByIdWithResponse { 2263 id: arg_id, 2264 _phantom: ::std::marker::PhantomData, 2265 }; 2266 2267 let request_env = match ::fbthrift::help::serialize_request_envelope::<P, _>("streamByIdWithResponse", &args) { 2268 ::std::result::Result::Ok(res) => res, 2269 ::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(), 2270 }; 2271 2272 let call_stream = self.transport() 2273 .call_stream(SERVICE_NAME.as_cstr(), METHOD_NAME.as_cstr(), request_env) 2274 .instrument(::tracing::trace_span!("call_stream", method = "MyService.streamByIdWithResponse")); 2275 2276 async move { 2277 let (_initial, stream) = call_stream.await?; 2278 2279 let new_stream = stream.then(|item_res| { 2280 async move { 2281 match item_res { 2282 ::std::result::Result::Err(err) => 2283 ::std::result::Result::Err(crate::errors::my_service::StreamByIdWithResponseStreamError::from(err)), 2284 ::std::result::Result::Ok(item_enc) => { 2285 let res = S::spawn(move || { 2286 let mut de = P::deserializer(item_enc); 2287 crate::services::my_service::StreamByIdWithResponseStreamExn::read(&mut de) 2288 }).await?; 2289 2290 let item: ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdWithResponseStreamError> = 2291 ::std::convert::From::from(res); 2292 item 2293 } 2294 } 2295 } 2296 }) 2297 .boxed(); 2298 2299 let de = P::deserializer(_initial); 2300 let res: crate::services::my_service::StreamByIdWithResponseExn = 2301 ::fbthrift::help::async_deserialize_response_envelope::<P, _, S>(de).await?.0?; 2302 2303 let initial: ::std::result::Result<crate::types::MyDataItem, crate::errors::my_service::StreamByIdWithResponseError> = 2304 ::std::convert::From::from(res); 2305 initial.map(move |initial| (initial, new_stream)) 2306 } 2307 .instrument(::tracing::info_span!("MyService.streamByIdWithResponse")) 2308 .boxed() 2309 } 2310 } 2311 2312 impl<'a, T> MyService for T 2313 where 2314 T: ::std::convert::AsRef<dyn MyService + 'a>, 2315 T: ::std::marker::Send, 2316 { ping( &self, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(), crate::errors::my_service::PingError>> + ::std::marker::Send + 'static>>2317 fn ping( 2318 &self, 2319 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(), crate::errors::my_service::PingError>> + ::std::marker::Send + 'static>> { 2320 self.as_ref().ping( 2321 ) 2322 } getRandomData( &self, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::string::String, crate::errors::my_service::GetRandomDataError>> + ::std::marker::Send + 'static>>2323 fn getRandomData( 2324 &self, 2325 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::string::String, crate::errors::my_service::GetRandomDataError>> + ::std::marker::Send + 'static>> { 2326 self.as_ref().getRandomData( 2327 ) 2328 } hasDataById( &self, arg_id: ::std::primitive::i64, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::primitive::bool, crate::errors::my_service::HasDataByIdError>> + ::std::marker::Send + 'static>>2329 fn hasDataById( 2330 &self, 2331 arg_id: ::std::primitive::i64, 2332 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::primitive::bool, crate::errors::my_service::HasDataByIdError>> + ::std::marker::Send + 'static>> { 2333 self.as_ref().hasDataById( 2334 arg_id, 2335 ) 2336 } getDataById( &self, arg_id: ::std::primitive::i64, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::string::String, crate::errors::my_service::GetDataByIdError>> + ::std::marker::Send + 'static>>2337 fn getDataById( 2338 &self, 2339 arg_id: ::std::primitive::i64, 2340 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::string::String, crate::errors::my_service::GetDataByIdError>> + ::std::marker::Send + 'static>> { 2341 self.as_ref().getDataById( 2342 arg_id, 2343 ) 2344 } putDataById( &self, arg_id: ::std::primitive::i64, arg_data: &::std::primitive::str, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(), crate::errors::my_service::PutDataByIdError>> + ::std::marker::Send + 'static>>2345 fn putDataById( 2346 &self, 2347 arg_id: ::std::primitive::i64, 2348 arg_data: &::std::primitive::str, 2349 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(), crate::errors::my_service::PutDataByIdError>> + ::std::marker::Send + 'static>> { 2350 self.as_ref().putDataById( 2351 arg_id, 2352 arg_data, 2353 ) 2354 } lobDataById( &self, arg_id: ::std::primitive::i64, arg_data: &::std::primitive::str, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(), crate::errors::my_service::LobDataByIdError>> + ::std::marker::Send + 'static>>2355 fn lobDataById( 2356 &self, 2357 arg_id: ::std::primitive::i64, 2358 arg_data: &::std::primitive::str, 2359 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(), crate::errors::my_service::LobDataByIdError>> + ::std::marker::Send + 'static>> { 2360 self.as_ref().lobDataById( 2361 arg_id, 2362 arg_data, 2363 ) 2364 } streamById( &self, arg_id: ::std::primitive::i64, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdStreamError>> + ::std::marker::Send + 'static >>, crate::errors::my_service::StreamByIdError>> + ::std::marker::Send + 'static>>2365 fn streamById( 2366 &self, 2367 arg_id: ::std::primitive::i64, 2368 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdStreamError>> + ::std::marker::Send + 'static >>, crate::errors::my_service::StreamByIdError>> + ::std::marker::Send + 'static>> { 2369 self.as_ref().streamById( 2370 arg_id, 2371 ) 2372 } streamByIdWithException( &self, arg_id: ::std::primitive::i64, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdWithExceptionStreamError>> + ::std::marker::Send + 'static >>, crate::errors::my_service::StreamByIdWithExceptionError>> + ::std::marker::Send + 'static>>2373 fn streamByIdWithException( 2374 &self, 2375 arg_id: ::std::primitive::i64, 2376 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdWithExceptionStreamError>> + ::std::marker::Send + 'static >>, crate::errors::my_service::StreamByIdWithExceptionError>> + ::std::marker::Send + 'static>> { 2377 self.as_ref().streamByIdWithException( 2378 arg_id, 2379 ) 2380 } streamByIdWithResponse( &self, arg_id: ::std::primitive::i64, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(crate::types::MyDataItem, ::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdWithResponseStreamError>> + ::std::marker::Send + 'static >>), crate::errors::my_service::StreamByIdWithResponseError>> + ::std::marker::Send + 'static>>2381 fn streamByIdWithResponse( 2382 &self, 2383 arg_id: ::std::primitive::i64, 2384 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(crate::types::MyDataItem, ::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdWithResponseStreamError>> + ::std::marker::Send + 'static >>), crate::errors::my_service::StreamByIdWithResponseError>> + ::std::marker::Send + 'static>> { 2385 self.as_ref().streamByIdWithResponse( 2386 arg_id, 2387 ) 2388 } 2389 } 2390 2391 #[derive(Clone)] 2392 pub struct make_MyService; 2393 2394 /// To be called by user directly setting up a client. Avoids 2395 /// needing ClientFactory trait in scope, avoids unidiomatic 2396 /// make_Trait name. 2397 /// 2398 /// ``` 2399 /// # const _: &str = stringify! { 2400 /// use bgs::client::BuckGraphService; 2401 /// 2402 /// let protocol = BinaryProtocol::new(); 2403 /// let transport = HttpClient::new(); 2404 /// let client = <dyn BuckGraphService>::new(protocol, transport); 2405 /// # }; 2406 /// ``` 2407 impl dyn MyService { 2408 pub const rust_request_context: &'static ::std::primitive::str = "1"; new<P, T>( protocol: P, transport: T, ) -> ::std::sync::Arc<impl MyService + ::std::marker::Send + 'static> where P: ::fbthrift::Protocol<Frame = T>, T: ::fbthrift::Transport, P::Deserializer: ::std::marker::Send,2409 pub fn new<P, T>( 2410 protocol: P, 2411 transport: T, 2412 ) -> ::std::sync::Arc<impl MyService + ::std::marker::Send + 'static> 2413 where 2414 P: ::fbthrift::Protocol<Frame = T>, 2415 T: ::fbthrift::Transport, 2416 P::Deserializer: ::std::marker::Send, 2417 { 2418 let spawner = ::fbthrift::help::NoopSpawner; 2419 Self::with_spawner(protocol, transport, spawner) 2420 } 2421 with_spawner<P, T, S>( protocol: P, transport: T, spawner: S, ) -> ::std::sync::Arc<impl MyService + ::std::marker::Send + 'static> where P: ::fbthrift::Protocol<Frame = T>, T: ::fbthrift::Transport, P::Deserializer: ::std::marker::Send, S: ::fbthrift::help::Spawner,2422 pub fn with_spawner<P, T, S>( 2423 protocol: P, 2424 transport: T, 2425 spawner: S, 2426 ) -> ::std::sync::Arc<impl MyService + ::std::marker::Send + 'static> 2427 where 2428 P: ::fbthrift::Protocol<Frame = T>, 2429 T: ::fbthrift::Transport, 2430 P::Deserializer: ::std::marker::Send, 2431 S: ::fbthrift::help::Spawner, 2432 { 2433 let _ = protocol; 2434 let _ = spawner; 2435 ::std::sync::Arc::new(MyServiceImpl::<P, T, S>::new(transport)) 2436 } 2437 } 2438 2439 pub type MyServiceDynClient = <make_MyService as ::fbthrift::ClientFactory>::Api; 2440 pub type MyServiceClient = ::std::sync::Arc<MyServiceDynClient>; 2441 2442 /// The same thing, but to be called from generic contexts where we are 2443 /// working with a type parameter `C: ClientFactory` to produce clients. 2444 impl ::fbthrift::ClientFactory for make_MyService { 2445 type Api = dyn MyService + ::std::marker::Send + ::std::marker::Sync + 'static; 2446 with_spawner<P, T, S>(protocol: P, transport: T, spawner: S) -> ::std::sync::Arc<Self::Api> where P: ::fbthrift::Protocol<Frame = T>, T: ::fbthrift::Transport + ::std::marker::Sync, P::Deserializer: ::std::marker::Send, S: ::fbthrift::help::Spawner,2447 fn with_spawner<P, T, S>(protocol: P, transport: T, spawner: S) -> ::std::sync::Arc<Self::Api> 2448 where 2449 P: ::fbthrift::Protocol<Frame = T>, 2450 T: ::fbthrift::Transport + ::std::marker::Sync, 2451 P::Deserializer: ::std::marker::Send, 2452 S: ::fbthrift::help::Spawner, 2453 { 2454 <dyn MyService>::with_spawner(protocol, transport, spawner) 2455 } 2456 } 2457 2458 2459 } 2460 2461 /// Server definitions for `module`. 2462 pub mod server { 2463 #[::async_trait::async_trait] 2464 pub trait MyService: ::std::marker::Send + ::std::marker::Sync + 'static { 2465 type RequestContext: ::std::marker::Sync; ping( &self, _request_context: &Self::RequestContext, ) -> ::std::result::Result<(), crate::services::my_service::PingExn>2466 async fn ping( 2467 &self, 2468 _request_context: &Self::RequestContext, 2469 ) -> ::std::result::Result<(), crate::services::my_service::PingExn> { 2470 ::std::result::Result::Err(crate::services::my_service::PingExn::ApplicationException( 2471 ::fbthrift::ApplicationException::unimplemented_method( 2472 "MyService", 2473 "ping", 2474 ), 2475 )) 2476 } getRandomData( &self, _request_context: &Self::RequestContext, ) -> ::std::result::Result<::std::string::String, crate::services::my_service::GetRandomDataExn>2477 async fn getRandomData( 2478 &self, 2479 _request_context: &Self::RequestContext, 2480 ) -> ::std::result::Result<::std::string::String, crate::services::my_service::GetRandomDataExn> { 2481 ::std::result::Result::Err(crate::services::my_service::GetRandomDataExn::ApplicationException( 2482 ::fbthrift::ApplicationException::unimplemented_method( 2483 "MyService", 2484 "getRandomData", 2485 ), 2486 )) 2487 } hasDataById( &self, _request_context: &Self::RequestContext, _id: ::std::primitive::i64, ) -> ::std::result::Result<::std::primitive::bool, crate::services::my_service::HasDataByIdExn>2488 async fn hasDataById( 2489 &self, 2490 _request_context: &Self::RequestContext, 2491 _id: ::std::primitive::i64, 2492 ) -> ::std::result::Result<::std::primitive::bool, crate::services::my_service::HasDataByIdExn> { 2493 ::std::result::Result::Err(crate::services::my_service::HasDataByIdExn::ApplicationException( 2494 ::fbthrift::ApplicationException::unimplemented_method( 2495 "MyService", 2496 "hasDataById", 2497 ), 2498 )) 2499 } getDataById( &self, _request_context: &Self::RequestContext, _id: ::std::primitive::i64, ) -> ::std::result::Result<::std::string::String, crate::services::my_service::GetDataByIdExn>2500 async fn getDataById( 2501 &self, 2502 _request_context: &Self::RequestContext, 2503 _id: ::std::primitive::i64, 2504 ) -> ::std::result::Result<::std::string::String, crate::services::my_service::GetDataByIdExn> { 2505 ::std::result::Result::Err(crate::services::my_service::GetDataByIdExn::ApplicationException( 2506 ::fbthrift::ApplicationException::unimplemented_method( 2507 "MyService", 2508 "getDataById", 2509 ), 2510 )) 2511 } putDataById( &self, _request_context: &Self::RequestContext, _id: ::std::primitive::i64, _data: ::std::string::String, ) -> ::std::result::Result<(), crate::services::my_service::PutDataByIdExn>2512 async fn putDataById( 2513 &self, 2514 _request_context: &Self::RequestContext, 2515 _id: ::std::primitive::i64, 2516 _data: ::std::string::String, 2517 ) -> ::std::result::Result<(), crate::services::my_service::PutDataByIdExn> { 2518 ::std::result::Result::Err(crate::services::my_service::PutDataByIdExn::ApplicationException( 2519 ::fbthrift::ApplicationException::unimplemented_method( 2520 "MyService", 2521 "putDataById", 2522 ), 2523 )) 2524 } lobDataById( &self, _request_context: &Self::RequestContext, _id: ::std::primitive::i64, _data: ::std::string::String, ) -> ::std::result::Result<(), crate::services::my_service::LobDataByIdExn>2525 async fn lobDataById( 2526 &self, 2527 _request_context: &Self::RequestContext, 2528 _id: ::std::primitive::i64, 2529 _data: ::std::string::String, 2530 ) -> ::std::result::Result<(), crate::services::my_service::LobDataByIdExn> { 2531 ::std::result::Result::Err(crate::services::my_service::LobDataByIdExn::ApplicationException( 2532 ::fbthrift::ApplicationException::unimplemented_method( 2533 "MyService", 2534 "lobDataById", 2535 ), 2536 )) 2537 } 2538 // streamById: server-side streaming not yet implemented 2539 // streamByIdWithException: server-side streaming not yet implemented 2540 // streamByIdWithResponse: server-side streaming not yet implemented 2541 } 2542 2543 /// Processor for MyService's methods. 2544 #[derive(Clone, Debug)] 2545 pub struct MyServiceProcessor<P, H, R> { 2546 service: H, 2547 supa: ::fbthrift::NullServiceProcessor<P, R>, 2548 _phantom: ::std::marker::PhantomData<(P, H, R)>, 2549 } 2550 2551 struct Args_MyService_ping { 2552 } 2553 impl<P: ::fbthrift::ProtocolReader> ::fbthrift::Deserialize<P> for self::Args_MyService_ping { 2554 #[inline] 2555 #[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "MyService.ping"))] read(p: &mut P) -> ::anyhow::Result<Self>2556 fn read(p: &mut P) -> ::anyhow::Result<Self> { 2557 static ARGS: &[::fbthrift::Field] = &[ 2558 ]; 2559 let _ = p.read_struct_begin(|_| ())?; 2560 loop { 2561 let (_, fty, fid) = p.read_field_begin(|_| (), ARGS)?; 2562 match (fty, fid as ::std::primitive::i32) { 2563 (::fbthrift::TType::Stop, _) => break, 2564 (fty, _) => p.skip(fty)?, 2565 } 2566 p.read_field_end()?; 2567 } 2568 p.read_struct_end()?; 2569 ::std::result::Result::Ok(Self { 2570 }) 2571 } 2572 } 2573 2574 struct Args_MyService_getRandomData { 2575 } 2576 impl<P: ::fbthrift::ProtocolReader> ::fbthrift::Deserialize<P> for self::Args_MyService_getRandomData { 2577 #[inline] 2578 #[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "MyService.getRandomData"))] read(p: &mut P) -> ::anyhow::Result<Self>2579 fn read(p: &mut P) -> ::anyhow::Result<Self> { 2580 static ARGS: &[::fbthrift::Field] = &[ 2581 ]; 2582 let _ = p.read_struct_begin(|_| ())?; 2583 loop { 2584 let (_, fty, fid) = p.read_field_begin(|_| (), ARGS)?; 2585 match (fty, fid as ::std::primitive::i32) { 2586 (::fbthrift::TType::Stop, _) => break, 2587 (fty, _) => p.skip(fty)?, 2588 } 2589 p.read_field_end()?; 2590 } 2591 p.read_struct_end()?; 2592 ::std::result::Result::Ok(Self { 2593 }) 2594 } 2595 } 2596 2597 struct Args_MyService_hasDataById { 2598 id: ::std::primitive::i64, 2599 } 2600 impl<P: ::fbthrift::ProtocolReader> ::fbthrift::Deserialize<P> for self::Args_MyService_hasDataById { 2601 #[inline] 2602 #[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "MyService.hasDataById"))] read(p: &mut P) -> ::anyhow::Result<Self>2603 fn read(p: &mut P) -> ::anyhow::Result<Self> { 2604 static ARGS: &[::fbthrift::Field] = &[ 2605 ::fbthrift::Field::new("id", ::fbthrift::TType::I64, 1), 2606 ]; 2607 let mut field_id = ::std::option::Option::None; 2608 let _ = p.read_struct_begin(|_| ())?; 2609 loop { 2610 let (_, fty, fid) = p.read_field_begin(|_| (), ARGS)?; 2611 match (fty, fid as ::std::primitive::i32) { 2612 (::fbthrift::TType::Stop, _) => break, 2613 (::fbthrift::TType::I64, 1) => field_id = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), 2614 (fty, _) => p.skip(fty)?, 2615 } 2616 p.read_field_end()?; 2617 } 2618 p.read_struct_end()?; 2619 ::std::result::Result::Ok(Self { 2620 id: field_id.ok_or_else(|| ::anyhow::anyhow!("`{}` missing arg `{}`", "MyService.hasDataById", "id"))?, 2621 }) 2622 } 2623 } 2624 2625 struct Args_MyService_getDataById { 2626 id: ::std::primitive::i64, 2627 } 2628 impl<P: ::fbthrift::ProtocolReader> ::fbthrift::Deserialize<P> for self::Args_MyService_getDataById { 2629 #[inline] 2630 #[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "MyService.getDataById"))] read(p: &mut P) -> ::anyhow::Result<Self>2631 fn read(p: &mut P) -> ::anyhow::Result<Self> { 2632 static ARGS: &[::fbthrift::Field] = &[ 2633 ::fbthrift::Field::new("id", ::fbthrift::TType::I64, 1), 2634 ]; 2635 let mut field_id = ::std::option::Option::None; 2636 let _ = p.read_struct_begin(|_| ())?; 2637 loop { 2638 let (_, fty, fid) = p.read_field_begin(|_| (), ARGS)?; 2639 match (fty, fid as ::std::primitive::i32) { 2640 (::fbthrift::TType::Stop, _) => break, 2641 (::fbthrift::TType::I64, 1) => field_id = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), 2642 (fty, _) => p.skip(fty)?, 2643 } 2644 p.read_field_end()?; 2645 } 2646 p.read_struct_end()?; 2647 ::std::result::Result::Ok(Self { 2648 id: field_id.ok_or_else(|| ::anyhow::anyhow!("`{}` missing arg `{}`", "MyService.getDataById", "id"))?, 2649 }) 2650 } 2651 } 2652 2653 struct Args_MyService_putDataById { 2654 id: ::std::primitive::i64, 2655 data: ::std::string::String, 2656 } 2657 impl<P: ::fbthrift::ProtocolReader> ::fbthrift::Deserialize<P> for self::Args_MyService_putDataById { 2658 #[inline] 2659 #[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "MyService.putDataById"))] read(p: &mut P) -> ::anyhow::Result<Self>2660 fn read(p: &mut P) -> ::anyhow::Result<Self> { 2661 static ARGS: &[::fbthrift::Field] = &[ 2662 ::fbthrift::Field::new("data", ::fbthrift::TType::String, 2), 2663 ::fbthrift::Field::new("id", ::fbthrift::TType::I64, 1), 2664 ]; 2665 let mut field_id = ::std::option::Option::None; 2666 let mut field_data = ::std::option::Option::None; 2667 let _ = p.read_struct_begin(|_| ())?; 2668 loop { 2669 let (_, fty, fid) = p.read_field_begin(|_| (), ARGS)?; 2670 match (fty, fid as ::std::primitive::i32) { 2671 (::fbthrift::TType::Stop, _) => break, 2672 (::fbthrift::TType::I64, 1) => field_id = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), 2673 (::fbthrift::TType::String, 2) => field_data = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), 2674 (fty, _) => p.skip(fty)?, 2675 } 2676 p.read_field_end()?; 2677 } 2678 p.read_struct_end()?; 2679 ::std::result::Result::Ok(Self { 2680 id: field_id.ok_or_else(|| ::anyhow::anyhow!("`{}` missing arg `{}`", "MyService.putDataById", "id"))?, 2681 data: field_data.ok_or_else(|| ::anyhow::anyhow!("`{}` missing arg `{}`", "MyService.putDataById", "data"))?, 2682 }) 2683 } 2684 } 2685 2686 struct Args_MyService_lobDataById { 2687 id: ::std::primitive::i64, 2688 data: ::std::string::String, 2689 } 2690 impl<P: ::fbthrift::ProtocolReader> ::fbthrift::Deserialize<P> for self::Args_MyService_lobDataById { 2691 #[inline] 2692 #[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "MyService.lobDataById"))] read(p: &mut P) -> ::anyhow::Result<Self>2693 fn read(p: &mut P) -> ::anyhow::Result<Self> { 2694 static ARGS: &[::fbthrift::Field] = &[ 2695 ::fbthrift::Field::new("data", ::fbthrift::TType::String, 2), 2696 ::fbthrift::Field::new("id", ::fbthrift::TType::I64, 1), 2697 ]; 2698 let mut field_id = ::std::option::Option::None; 2699 let mut field_data = ::std::option::Option::None; 2700 let _ = p.read_struct_begin(|_| ())?; 2701 loop { 2702 let (_, fty, fid) = p.read_field_begin(|_| (), ARGS)?; 2703 match (fty, fid as ::std::primitive::i32) { 2704 (::fbthrift::TType::Stop, _) => break, 2705 (::fbthrift::TType::I64, 1) => field_id = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), 2706 (::fbthrift::TType::String, 2) => field_data = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), 2707 (fty, _) => p.skip(fty)?, 2708 } 2709 p.read_field_end()?; 2710 } 2711 p.read_struct_end()?; 2712 ::std::result::Result::Ok(Self { 2713 id: field_id.ok_or_else(|| ::anyhow::anyhow!("`{}` missing arg `{}`", "MyService.lobDataById", "id"))?, 2714 data: field_data.ok_or_else(|| ::anyhow::anyhow!("`{}` missing arg `{}`", "MyService.lobDataById", "data"))?, 2715 }) 2716 } 2717 } 2718 2719 2720 impl<P, H, R> MyServiceProcessor<P, H, R> 2721 where 2722 P: ::fbthrift::Protocol + ::std::marker::Send + ::std::marker::Sync + 'static, 2723 P::Deserializer: ::std::marker::Send, 2724 H: MyService<RequestContext = R>, 2725 R: ::fbthrift::RequestContext<Name = ::std::ffi::CStr> + ::std::marker::Sync, 2726 <R as ::fbthrift::RequestContext>::ContextStack: ::fbthrift::ContextStack<Name = R::Name, Buffer = ::fbthrift::ProtocolDecoded<P>> 2727 + ::std::marker::Send + ::std::marker::Sync, 2728 { new(service: H) -> Self2729 pub fn new(service: H) -> Self { 2730 Self { 2731 service, 2732 supa: ::fbthrift::NullServiceProcessor::new(), 2733 _phantom: ::std::marker::PhantomData, 2734 } 2735 } 2736 into_inner(self) -> H2737 pub fn into_inner(self) -> H { 2738 self.service 2739 } 2740 2741 #[::tracing::instrument(skip_all, fields(method = "MyService.ping"))] handle_ping<'a>( &'a self, p: &'a mut P::Deserializer, _req_ctxt: &R, ctx_stack: &mut R::ContextStack, ) -> ::anyhow::Result<crate::services::my_service::PingExn>2742 async fn handle_ping<'a>( 2743 &'a self, 2744 p: &'a mut P::Deserializer, 2745 _req_ctxt: &R, 2746 ctx_stack: &mut R::ContextStack, 2747 ) -> ::anyhow::Result<crate::services::my_service::PingExn> { 2748 use ::const_cstr::const_cstr; 2749 use ::tracing::Instrument as _; 2750 use ::futures::FutureExt as _; 2751 2752 const_cstr! { 2753 SERVICE_NAME = "MyService"; 2754 METHOD_NAME = "MyService.ping"; 2755 } 2756 ::fbthrift::ContextStack::pre_read(ctx_stack)?; 2757 let _args: self::Args_MyService_ping = ::fbthrift::Deserialize::read(p)?; 2758 ::fbthrift::ContextStack::on_read_data(ctx_stack, &::fbthrift::SerializedMessage { 2759 protocol: P::PROTOCOL_ID, 2760 method_name: METHOD_NAME.as_cstr(), 2761 buffer: ::std::marker::PhantomData, // FIXME P::into_buffer(p).reset(), 2762 })?; 2763 ::fbthrift::ContextStack::post_read(ctx_stack, 0)?; 2764 2765 let res = ::std::panic::AssertUnwindSafe( 2766 self.service.ping( 2767 _req_ctxt, 2768 ) 2769 ) 2770 .catch_unwind() 2771 .instrument(::tracing::info_span!("service_handler", method = "MyService.ping")) 2772 .await; 2773 2774 // nested results - panic catch on the outside, method on the inside 2775 let res = match res { 2776 ::std::result::Result::Ok(::std::result::Result::Ok(res)) => { 2777 ::tracing::info!(method = "MyService.ping", "success"); 2778 crate::services::my_service::PingExn::Success(res) 2779 } 2780 ::std::result::Result::Ok(::std::result::Result::Err(crate::services::my_service::PingExn::Success(_))) => { 2781 panic!( 2782 "{} attempted to return success via error", 2783 "ping", 2784 ) 2785 } 2786 ::std::result::Result::Ok(::std::result::Result::Err(exn)) => { 2787 ::tracing::error!(method = "MyService.ping", exception = ?exn); 2788 exn 2789 } 2790 ::std::result::Result::Err(exn) => { 2791 let aexn = ::fbthrift::ApplicationException::handler_panic("MyService.ping", exn); 2792 crate::services::my_service::PingExn::ApplicationException(aexn) 2793 } 2794 }; 2795 2796 ::std::result::Result::Ok(res) 2797 } 2798 2799 #[::tracing::instrument(skip_all, fields(method = "MyService.getRandomData"))] handle_getRandomData<'a>( &'a self, p: &'a mut P::Deserializer, _req_ctxt: &R, ctx_stack: &mut R::ContextStack, ) -> ::anyhow::Result<crate::services::my_service::GetRandomDataExn>2800 async fn handle_getRandomData<'a>( 2801 &'a self, 2802 p: &'a mut P::Deserializer, 2803 _req_ctxt: &R, 2804 ctx_stack: &mut R::ContextStack, 2805 ) -> ::anyhow::Result<crate::services::my_service::GetRandomDataExn> { 2806 use ::const_cstr::const_cstr; 2807 use ::tracing::Instrument as _; 2808 use ::futures::FutureExt as _; 2809 2810 const_cstr! { 2811 SERVICE_NAME = "MyService"; 2812 METHOD_NAME = "MyService.getRandomData"; 2813 } 2814 ::fbthrift::ContextStack::pre_read(ctx_stack)?; 2815 let _args: self::Args_MyService_getRandomData = ::fbthrift::Deserialize::read(p)?; 2816 ::fbthrift::ContextStack::on_read_data(ctx_stack, &::fbthrift::SerializedMessage { 2817 protocol: P::PROTOCOL_ID, 2818 method_name: METHOD_NAME.as_cstr(), 2819 buffer: ::std::marker::PhantomData, // FIXME P::into_buffer(p).reset(), 2820 })?; 2821 ::fbthrift::ContextStack::post_read(ctx_stack, 0)?; 2822 2823 let res = ::std::panic::AssertUnwindSafe( 2824 self.service.getRandomData( 2825 _req_ctxt, 2826 ) 2827 ) 2828 .catch_unwind() 2829 .instrument(::tracing::info_span!("service_handler", method = "MyService.getRandomData")) 2830 .await; 2831 2832 // nested results - panic catch on the outside, method on the inside 2833 let res = match res { 2834 ::std::result::Result::Ok(::std::result::Result::Ok(res)) => { 2835 ::tracing::info!(method = "MyService.getRandomData", "success"); 2836 crate::services::my_service::GetRandomDataExn::Success(res) 2837 } 2838 ::std::result::Result::Ok(::std::result::Result::Err(crate::services::my_service::GetRandomDataExn::Success(_))) => { 2839 panic!( 2840 "{} attempted to return success via error", 2841 "getRandomData", 2842 ) 2843 } 2844 ::std::result::Result::Ok(::std::result::Result::Err(exn)) => { 2845 ::tracing::error!(method = "MyService.getRandomData", exception = ?exn); 2846 exn 2847 } 2848 ::std::result::Result::Err(exn) => { 2849 let aexn = ::fbthrift::ApplicationException::handler_panic("MyService.getRandomData", exn); 2850 crate::services::my_service::GetRandomDataExn::ApplicationException(aexn) 2851 } 2852 }; 2853 2854 ::std::result::Result::Ok(res) 2855 } 2856 2857 #[::tracing::instrument(skip_all, fields(method = "MyService.hasDataById"))] handle_hasDataById<'a>( &'a self, p: &'a mut P::Deserializer, _req_ctxt: &R, ctx_stack: &mut R::ContextStack, ) -> ::anyhow::Result<crate::services::my_service::HasDataByIdExn>2858 async fn handle_hasDataById<'a>( 2859 &'a self, 2860 p: &'a mut P::Deserializer, 2861 _req_ctxt: &R, 2862 ctx_stack: &mut R::ContextStack, 2863 ) -> ::anyhow::Result<crate::services::my_service::HasDataByIdExn> { 2864 use ::const_cstr::const_cstr; 2865 use ::tracing::Instrument as _; 2866 use ::futures::FutureExt as _; 2867 2868 const_cstr! { 2869 SERVICE_NAME = "MyService"; 2870 METHOD_NAME = "MyService.hasDataById"; 2871 } 2872 ::fbthrift::ContextStack::pre_read(ctx_stack)?; 2873 let _args: self::Args_MyService_hasDataById = ::fbthrift::Deserialize::read(p)?; 2874 ::fbthrift::ContextStack::on_read_data(ctx_stack, &::fbthrift::SerializedMessage { 2875 protocol: P::PROTOCOL_ID, 2876 method_name: METHOD_NAME.as_cstr(), 2877 buffer: ::std::marker::PhantomData, // FIXME P::into_buffer(p).reset(), 2878 })?; 2879 ::fbthrift::ContextStack::post_read(ctx_stack, 0)?; 2880 2881 let res = ::std::panic::AssertUnwindSafe( 2882 self.service.hasDataById( 2883 _req_ctxt, 2884 _args.id, 2885 ) 2886 ) 2887 .catch_unwind() 2888 .instrument(::tracing::info_span!("service_handler", method = "MyService.hasDataById")) 2889 .await; 2890 2891 // nested results - panic catch on the outside, method on the inside 2892 let res = match res { 2893 ::std::result::Result::Ok(::std::result::Result::Ok(res)) => { 2894 ::tracing::info!(method = "MyService.hasDataById", "success"); 2895 crate::services::my_service::HasDataByIdExn::Success(res) 2896 } 2897 ::std::result::Result::Ok(::std::result::Result::Err(crate::services::my_service::HasDataByIdExn::Success(_))) => { 2898 panic!( 2899 "{} attempted to return success via error", 2900 "hasDataById", 2901 ) 2902 } 2903 ::std::result::Result::Ok(::std::result::Result::Err(exn)) => { 2904 ::tracing::error!(method = "MyService.hasDataById", exception = ?exn); 2905 exn 2906 } 2907 ::std::result::Result::Err(exn) => { 2908 let aexn = ::fbthrift::ApplicationException::handler_panic("MyService.hasDataById", exn); 2909 crate::services::my_service::HasDataByIdExn::ApplicationException(aexn) 2910 } 2911 }; 2912 2913 ::std::result::Result::Ok(res) 2914 } 2915 2916 #[::tracing::instrument(skip_all, fields(method = "MyService.getDataById"))] handle_getDataById<'a>( &'a self, p: &'a mut P::Deserializer, _req_ctxt: &R, ctx_stack: &mut R::ContextStack, ) -> ::anyhow::Result<crate::services::my_service::GetDataByIdExn>2917 async fn handle_getDataById<'a>( 2918 &'a self, 2919 p: &'a mut P::Deserializer, 2920 _req_ctxt: &R, 2921 ctx_stack: &mut R::ContextStack, 2922 ) -> ::anyhow::Result<crate::services::my_service::GetDataByIdExn> { 2923 use ::const_cstr::const_cstr; 2924 use ::tracing::Instrument as _; 2925 use ::futures::FutureExt as _; 2926 2927 const_cstr! { 2928 SERVICE_NAME = "MyService"; 2929 METHOD_NAME = "MyService.getDataById"; 2930 } 2931 ::fbthrift::ContextStack::pre_read(ctx_stack)?; 2932 let _args: self::Args_MyService_getDataById = ::fbthrift::Deserialize::read(p)?; 2933 ::fbthrift::ContextStack::on_read_data(ctx_stack, &::fbthrift::SerializedMessage { 2934 protocol: P::PROTOCOL_ID, 2935 method_name: METHOD_NAME.as_cstr(), 2936 buffer: ::std::marker::PhantomData, // FIXME P::into_buffer(p).reset(), 2937 })?; 2938 ::fbthrift::ContextStack::post_read(ctx_stack, 0)?; 2939 2940 let res = ::std::panic::AssertUnwindSafe( 2941 self.service.getDataById( 2942 _req_ctxt, 2943 _args.id, 2944 ) 2945 ) 2946 .catch_unwind() 2947 .instrument(::tracing::info_span!("service_handler", method = "MyService.getDataById")) 2948 .await; 2949 2950 // nested results - panic catch on the outside, method on the inside 2951 let res = match res { 2952 ::std::result::Result::Ok(::std::result::Result::Ok(res)) => { 2953 ::tracing::info!(method = "MyService.getDataById", "success"); 2954 crate::services::my_service::GetDataByIdExn::Success(res) 2955 } 2956 ::std::result::Result::Ok(::std::result::Result::Err(crate::services::my_service::GetDataByIdExn::Success(_))) => { 2957 panic!( 2958 "{} attempted to return success via error", 2959 "getDataById", 2960 ) 2961 } 2962 ::std::result::Result::Ok(::std::result::Result::Err(exn)) => { 2963 ::tracing::error!(method = "MyService.getDataById", exception = ?exn); 2964 exn 2965 } 2966 ::std::result::Result::Err(exn) => { 2967 let aexn = ::fbthrift::ApplicationException::handler_panic("MyService.getDataById", exn); 2968 crate::services::my_service::GetDataByIdExn::ApplicationException(aexn) 2969 } 2970 }; 2971 2972 ::std::result::Result::Ok(res) 2973 } 2974 2975 #[::tracing::instrument(skip_all, fields(method = "MyService.putDataById"))] handle_putDataById<'a>( &'a self, p: &'a mut P::Deserializer, _req_ctxt: &R, ctx_stack: &mut R::ContextStack, ) -> ::anyhow::Result<crate::services::my_service::PutDataByIdExn>2976 async fn handle_putDataById<'a>( 2977 &'a self, 2978 p: &'a mut P::Deserializer, 2979 _req_ctxt: &R, 2980 ctx_stack: &mut R::ContextStack, 2981 ) -> ::anyhow::Result<crate::services::my_service::PutDataByIdExn> { 2982 use ::const_cstr::const_cstr; 2983 use ::tracing::Instrument as _; 2984 use ::futures::FutureExt as _; 2985 2986 const_cstr! { 2987 SERVICE_NAME = "MyService"; 2988 METHOD_NAME = "MyService.putDataById"; 2989 } 2990 ::fbthrift::ContextStack::pre_read(ctx_stack)?; 2991 let _args: self::Args_MyService_putDataById = ::fbthrift::Deserialize::read(p)?; 2992 ::fbthrift::ContextStack::on_read_data(ctx_stack, &::fbthrift::SerializedMessage { 2993 protocol: P::PROTOCOL_ID, 2994 method_name: METHOD_NAME.as_cstr(), 2995 buffer: ::std::marker::PhantomData, // FIXME P::into_buffer(p).reset(), 2996 })?; 2997 ::fbthrift::ContextStack::post_read(ctx_stack, 0)?; 2998 2999 let res = ::std::panic::AssertUnwindSafe( 3000 self.service.putDataById( 3001 _req_ctxt, 3002 _args.id, 3003 _args.data, 3004 ) 3005 ) 3006 .catch_unwind() 3007 .instrument(::tracing::info_span!("service_handler", method = "MyService.putDataById")) 3008 .await; 3009 3010 // nested results - panic catch on the outside, method on the inside 3011 let res = match res { 3012 ::std::result::Result::Ok(::std::result::Result::Ok(res)) => { 3013 ::tracing::info!(method = "MyService.putDataById", "success"); 3014 crate::services::my_service::PutDataByIdExn::Success(res) 3015 } 3016 ::std::result::Result::Ok(::std::result::Result::Err(crate::services::my_service::PutDataByIdExn::Success(_))) => { 3017 panic!( 3018 "{} attempted to return success via error", 3019 "putDataById", 3020 ) 3021 } 3022 ::std::result::Result::Ok(::std::result::Result::Err(exn)) => { 3023 ::tracing::error!(method = "MyService.putDataById", exception = ?exn); 3024 exn 3025 } 3026 ::std::result::Result::Err(exn) => { 3027 let aexn = ::fbthrift::ApplicationException::handler_panic("MyService.putDataById", exn); 3028 crate::services::my_service::PutDataByIdExn::ApplicationException(aexn) 3029 } 3030 }; 3031 3032 ::std::result::Result::Ok(res) 3033 } 3034 3035 #[::tracing::instrument(skip_all, fields(method = "MyService.lobDataById"))] handle_lobDataById<'a>( &'a self, p: &'a mut P::Deserializer, _req_ctxt: &R, ctx_stack: &mut R::ContextStack, ) -> ::anyhow::Result<crate::services::my_service::LobDataByIdExn>3036 async fn handle_lobDataById<'a>( 3037 &'a self, 3038 p: &'a mut P::Deserializer, 3039 _req_ctxt: &R, 3040 ctx_stack: &mut R::ContextStack, 3041 ) -> ::anyhow::Result<crate::services::my_service::LobDataByIdExn> { 3042 use ::const_cstr::const_cstr; 3043 use ::tracing::Instrument as _; 3044 use ::futures::FutureExt as _; 3045 3046 const_cstr! { 3047 SERVICE_NAME = "MyService"; 3048 METHOD_NAME = "MyService.lobDataById"; 3049 } 3050 ::fbthrift::ContextStack::pre_read(ctx_stack)?; 3051 let _args: self::Args_MyService_lobDataById = ::fbthrift::Deserialize::read(p)?; 3052 ::fbthrift::ContextStack::on_read_data(ctx_stack, &::fbthrift::SerializedMessage { 3053 protocol: P::PROTOCOL_ID, 3054 method_name: METHOD_NAME.as_cstr(), 3055 buffer: ::std::marker::PhantomData, // FIXME P::into_buffer(p).reset(), 3056 })?; 3057 ::fbthrift::ContextStack::post_read(ctx_stack, 0)?; 3058 3059 let res = ::std::panic::AssertUnwindSafe( 3060 self.service.lobDataById( 3061 _req_ctxt, 3062 _args.id, 3063 _args.data, 3064 ) 3065 ) 3066 .catch_unwind() 3067 .instrument(::tracing::info_span!("service_handler", method = "MyService.lobDataById")) 3068 .await; 3069 3070 // nested results - panic catch on the outside, method on the inside 3071 let res = match res { 3072 ::std::result::Result::Ok(::std::result::Result::Ok(res)) => { 3073 ::tracing::info!(method = "MyService.lobDataById", "success"); 3074 crate::services::my_service::LobDataByIdExn::Success(res) 3075 } 3076 ::std::result::Result::Ok(::std::result::Result::Err(crate::services::my_service::LobDataByIdExn::Success(_))) => { 3077 panic!( 3078 "{} attempted to return success via error", 3079 "lobDataById", 3080 ) 3081 } 3082 ::std::result::Result::Ok(::std::result::Result::Err(exn)) => { 3083 ::tracing::error!(method = "MyService.lobDataById", exception = ?exn); 3084 exn 3085 } 3086 ::std::result::Result::Err(exn) => { 3087 let aexn = ::fbthrift::ApplicationException::handler_panic("MyService.lobDataById", exn); 3088 crate::services::my_service::LobDataByIdExn::ApplicationException(aexn) 3089 } 3090 }; 3091 3092 ::std::result::Result::Ok(res) 3093 } 3094 } 3095 3096 #[::async_trait::async_trait] 3097 impl<P, H, R> ::fbthrift::ServiceProcessor<P> for MyServiceProcessor<P, H, R> 3098 where 3099 P: ::fbthrift::Protocol + ::std::marker::Send + ::std::marker::Sync + 'static, 3100 P::Deserializer: ::std::marker::Send, 3101 H: MyService<RequestContext = R>, 3102 R: ::fbthrift::RequestContext<Name = ::std::ffi::CStr> + ::std::marker::Send + ::std::marker::Sync + 'static, 3103 <R as ::fbthrift::RequestContext>::ContextStack: ::fbthrift::ContextStack<Name = R::Name, Buffer = ::fbthrift::ProtocolDecoded<P>> 3104 + ::std::marker::Send + ::std::marker::Sync + 'static 3105 { 3106 type RequestContext = R; 3107 3108 #[inline] method_idx(&self, name: &[::std::primitive::u8]) -> ::std::result::Result<::std::primitive::usize, ::fbthrift::ApplicationException>3109 fn method_idx(&self, name: &[::std::primitive::u8]) -> ::std::result::Result<::std::primitive::usize, ::fbthrift::ApplicationException> { 3110 match name { 3111 b"ping" => ::std::result::Result::Ok(0usize), 3112 b"getRandomData" => ::std::result::Result::Ok(1usize), 3113 b"hasDataById" => ::std::result::Result::Ok(2usize), 3114 b"getDataById" => ::std::result::Result::Ok(3usize), 3115 b"putDataById" => ::std::result::Result::Ok(4usize), 3116 b"lobDataById" => ::std::result::Result::Ok(5usize), 3117 _ => ::std::result::Result::Err(::fbthrift::ApplicationException::unknown_method()), 3118 } 3119 } 3120 handle_method( &self, idx: ::std::primitive::usize, _p: &mut P::Deserializer, _r: &R, _seqid: ::std::primitive::u32, ) -> ::anyhow::Result<::fbthrift::ProtocolEncodedFinal<P>>3121 async fn handle_method( 3122 &self, 3123 idx: ::std::primitive::usize, 3124 _p: &mut P::Deserializer, 3125 _r: &R, 3126 _seqid: ::std::primitive::u32, 3127 ) -> ::anyhow::Result<::fbthrift::ProtocolEncodedFinal<P>> { 3128 match idx { 3129 0usize => { 3130 use const_cstr::const_cstr; 3131 const_cstr! { 3132 SERVICE_NAME = "MyService"; 3133 METHOD_NAME = "MyService.ping"; 3134 } 3135 let mut ctx_stack = _r.get_context_stack( 3136 SERVICE_NAME.as_cstr(), 3137 METHOD_NAME.as_cstr(), 3138 )?; 3139 let res = self.handle_ping(_p, _r, &mut ctx_stack).await?; 3140 let env = ::fbthrift::help::serialize_result_envelope::<P, R, _>( 3141 "ping", 3142 METHOD_NAME.as_cstr(), 3143 _seqid, 3144 _r, 3145 &mut ctx_stack, 3146 res 3147 )?; 3148 Ok(env) 3149 } 3150 1usize => { 3151 use const_cstr::const_cstr; 3152 const_cstr! { 3153 SERVICE_NAME = "MyService"; 3154 METHOD_NAME = "MyService.getRandomData"; 3155 } 3156 let mut ctx_stack = _r.get_context_stack( 3157 SERVICE_NAME.as_cstr(), 3158 METHOD_NAME.as_cstr(), 3159 )?; 3160 let res = self.handle_getRandomData(_p, _r, &mut ctx_stack).await?; 3161 let env = ::fbthrift::help::serialize_result_envelope::<P, R, _>( 3162 "getRandomData", 3163 METHOD_NAME.as_cstr(), 3164 _seqid, 3165 _r, 3166 &mut ctx_stack, 3167 res 3168 )?; 3169 Ok(env) 3170 } 3171 2usize => { 3172 use const_cstr::const_cstr; 3173 const_cstr! { 3174 SERVICE_NAME = "MyService"; 3175 METHOD_NAME = "MyService.hasDataById"; 3176 } 3177 let mut ctx_stack = _r.get_context_stack( 3178 SERVICE_NAME.as_cstr(), 3179 METHOD_NAME.as_cstr(), 3180 )?; 3181 let res = self.handle_hasDataById(_p, _r, &mut ctx_stack).await?; 3182 let env = ::fbthrift::help::serialize_result_envelope::<P, R, _>( 3183 "hasDataById", 3184 METHOD_NAME.as_cstr(), 3185 _seqid, 3186 _r, 3187 &mut ctx_stack, 3188 res 3189 )?; 3190 Ok(env) 3191 } 3192 3usize => { 3193 use const_cstr::const_cstr; 3194 const_cstr! { 3195 SERVICE_NAME = "MyService"; 3196 METHOD_NAME = "MyService.getDataById"; 3197 } 3198 let mut ctx_stack = _r.get_context_stack( 3199 SERVICE_NAME.as_cstr(), 3200 METHOD_NAME.as_cstr(), 3201 )?; 3202 let res = self.handle_getDataById(_p, _r, &mut ctx_stack).await?; 3203 let env = ::fbthrift::help::serialize_result_envelope::<P, R, _>( 3204 "getDataById", 3205 METHOD_NAME.as_cstr(), 3206 _seqid, 3207 _r, 3208 &mut ctx_stack, 3209 res 3210 )?; 3211 Ok(env) 3212 } 3213 4usize => { 3214 use const_cstr::const_cstr; 3215 const_cstr! { 3216 SERVICE_NAME = "MyService"; 3217 METHOD_NAME = "MyService.putDataById"; 3218 } 3219 let mut ctx_stack = _r.get_context_stack( 3220 SERVICE_NAME.as_cstr(), 3221 METHOD_NAME.as_cstr(), 3222 )?; 3223 let res = self.handle_putDataById(_p, _r, &mut ctx_stack).await?; 3224 let env = ::fbthrift::help::serialize_result_envelope::<P, R, _>( 3225 "putDataById", 3226 METHOD_NAME.as_cstr(), 3227 _seqid, 3228 _r, 3229 &mut ctx_stack, 3230 res 3231 )?; 3232 Ok(env) 3233 } 3234 5usize => { 3235 use const_cstr::const_cstr; 3236 const_cstr! { 3237 SERVICE_NAME = "MyService"; 3238 METHOD_NAME = "MyService.lobDataById"; 3239 } 3240 let mut ctx_stack = _r.get_context_stack( 3241 SERVICE_NAME.as_cstr(), 3242 METHOD_NAME.as_cstr(), 3243 )?; 3244 let res = self.handle_lobDataById(_p, _r, &mut ctx_stack).await?; 3245 let env = ::fbthrift::help::serialize_result_envelope::<P, R, _>( 3246 "lobDataById", 3247 METHOD_NAME.as_cstr(), 3248 _seqid, 3249 _r, 3250 &mut ctx_stack, 3251 res 3252 )?; 3253 Ok(env) 3254 } 3255 bad => panic!( 3256 "{}: unexpected method idx {}", 3257 "MyServiceProcessor", 3258 bad 3259 ), 3260 } 3261 } 3262 } 3263 3264 #[::async_trait::async_trait] 3265 impl<P, H, R> ::fbthrift::ThriftService<P::Frame> for MyServiceProcessor<P, H, R> 3266 where 3267 P: ::fbthrift::Protocol + ::std::marker::Send + ::std::marker::Sync + 'static, 3268 P::Deserializer: ::std::marker::Send, 3269 P::Frame: ::std::marker::Send + 'static, 3270 H: MyService<RequestContext = R>, 3271 R: ::fbthrift::RequestContext<Name = ::std::ffi::CStr> + ::std::marker::Send + ::std::marker::Sync + 'static, 3272 <R as ::fbthrift::RequestContext>::ContextStack: ::fbthrift::ContextStack<Name = R::Name, Buffer = ::fbthrift::ProtocolDecoded<P>> 3273 + ::std::marker::Send + ::std::marker::Sync + 'static 3274 { 3275 type Handler = H; 3276 type RequestContext = R; 3277 3278 #[tracing::instrument(level="trace", skip_all, fields(service = "MyService"))] call( &self, req: ::fbthrift::ProtocolDecoded<P>, req_ctxt: &R, ) -> ::anyhow::Result<::fbthrift::ProtocolEncodedFinal<P>>3279 async fn call( 3280 &self, 3281 req: ::fbthrift::ProtocolDecoded<P>, 3282 req_ctxt: &R, 3283 ) -> ::anyhow::Result<::fbthrift::ProtocolEncodedFinal<P>> { 3284 use ::fbthrift::{BufExt as _, ProtocolReader as _, ServiceProcessor as _}; 3285 let mut p = P::deserializer(req); 3286 let (idx, mty, seqid) = p.read_message_begin(|name| self.method_idx(name))?; 3287 if mty != ::fbthrift::MessageType::Call { 3288 return ::std::result::Result::Err(::std::convert::From::from(::fbthrift::ApplicationException::new( 3289 ::fbthrift::ApplicationExceptionErrorCode::InvalidMessageType, 3290 format!("message type {:?} not handled", mty) 3291 ))); 3292 } 3293 let idx = match idx { 3294 ::std::result::Result::Ok(idx) => idx, 3295 ::std::result::Result::Err(_) => { 3296 let cur = P::into_buffer(p).reset(); 3297 return self.supa.call(cur, req_ctxt).await; 3298 } 3299 }; 3300 let res = self.handle_method(idx, &mut p, req_ctxt, seqid).await?; 3301 p.read_message_end()?; 3302 3303 Ok(res) 3304 } 3305 } 3306 3307 /// Construct a new instance of a MyService service. 3308 /// 3309 /// This is called when a new instance of a Thrift service Processor 3310 /// is needed for a particular Thrift protocol. 3311 #[::tracing::instrument(level="debug", skip_all, fields(proto = ?proto))] make_MyService_server<F, H, R>( proto: ::fbthrift::ProtocolID, handler: H, ) -> ::std::result::Result<::std::boxed::Box<dyn ::fbthrift::ThriftService<F, Handler = H, RequestContext = R> + ::std::marker::Send + 'static>, ::fbthrift::ApplicationException> where F: ::fbthrift::Framing + ::std::marker::Send + ::std::marker::Sync + 'static, H: MyService<RequestContext = R>, R: ::fbthrift::RequestContext<Name = ::std::ffi::CStr> + ::std::marker::Send + ::std::marker::Sync + 'static, <R as ::fbthrift::RequestContext>::ContextStack: ::fbthrift::ContextStack<Name = R::Name, Buffer = F::DecBuf> + ::std::marker::Send + ::std::marker::Sync + 'static3312 pub fn make_MyService_server<F, H, R>( 3313 proto: ::fbthrift::ProtocolID, 3314 handler: H, 3315 ) -> ::std::result::Result<::std::boxed::Box<dyn ::fbthrift::ThriftService<F, Handler = H, RequestContext = R> + ::std::marker::Send + 'static>, ::fbthrift::ApplicationException> 3316 where 3317 F: ::fbthrift::Framing + ::std::marker::Send + ::std::marker::Sync + 'static, 3318 H: MyService<RequestContext = R>, 3319 R: ::fbthrift::RequestContext<Name = ::std::ffi::CStr> + ::std::marker::Send + ::std::marker::Sync + 'static, 3320 <R as ::fbthrift::RequestContext>::ContextStack: ::fbthrift::ContextStack<Name = R::Name, Buffer = F::DecBuf> + ::std::marker::Send + ::std::marker::Sync + 'static 3321 { 3322 match proto { 3323 ::fbthrift::ProtocolID::BinaryProtocol => { 3324 ::std::result::Result::Ok(::std::boxed::Box::new(MyServiceProcessor::<::fbthrift::BinaryProtocol<F>, H, R>::new(handler))) 3325 } 3326 ::fbthrift::ProtocolID::CompactProtocol => { 3327 ::std::result::Result::Ok(::std::boxed::Box::new(MyServiceProcessor::<::fbthrift::CompactProtocol<F>, H, R>::new(handler))) 3328 } 3329 bad => { 3330 ::tracing::error!(method = "MyService.", invalid_protocol = ?bad); 3331 ::std::result::Result::Err(::fbthrift::ApplicationException::invalid_protocol(bad)) 3332 } 3333 } 3334 } 3335 } 3336 3337 /// Client mocks. For every service, a struct mock::TheService that implements 3338 /// client::TheService. 3339 /// 3340 /// As an example of the generated API, for the following thrift service: 3341 /// 3342 /// ```thrift 3343 /// service MyService { 3344 /// FunctionResponse myFunction( 3345 /// 1: FunctionRequest request, 3346 /// ) throws { 3347 /// 1: StorageException s, 3348 /// 2: NotFoundException n, 3349 /// ), 3350 /// 3351 /// // other functions 3352 /// } 3353 /// ``` 3354 /// 3355 /// we would end up with this mock object under crate::mock::MyService: 3356 /// 3357 /// ``` 3358 /// # const _: &str = stringify! { 3359 /// impl crate::client::MyService for MyService<'mock> {...} 3360 /// 3361 /// pub struct MyService<'mock> { 3362 /// pub myFunction: myFunction<'mock>, 3363 /// // ... 3364 /// } 3365 /// 3366 /// impl dyn crate::client::MyService { 3367 /// pub fn mock<'mock>() -> MyService<'mock>; 3368 /// } 3369 /// 3370 /// impl myFunction<'mock> { 3371 /// // directly return the given success response 3372 /// pub fn ret(&self, value: FunctionResponse); 3373 /// 3374 /// // invoke closure to compute success response 3375 /// pub fn mock( 3376 /// &self, 3377 /// mock: impl FnMut(FunctionRequest) -> FunctionResponse + Send + Sync + 'mock, 3378 /// ); 3379 /// 3380 /// // invoke closure to compute response 3381 /// pub fn mock_result( 3382 /// &self, 3383 /// mock: impl FnMut(FunctionRequest) -> Result<FunctionResponse, crate::services::MyService::MyFunctionExn> + Send + Sync + 'mock, 3384 /// ); 3385 /// 3386 /// // return one of the function's declared exceptions 3387 /// pub fn throw<E>(&self, exception: E) 3388 /// where 3389 /// E: Clone + Into<crate::services::MyService::MyFunctionExn> + Send + Sync + 'mock; 3390 /// } 3391 /// 3392 /// impl From<StorageException> for MyFunctionExn {...} 3393 /// impl From<NotFoundException> for MyFunctionExn {...} 3394 /// # }; 3395 /// ``` 3396 /// 3397 /// The intended usage from a test would be: 3398 /// 3399 /// ``` 3400 /// # const _: &str = stringify! { 3401 /// use std::sync::Arc; 3402 /// use thrift_if::client::MyService; 3403 /// 3404 /// #[test] 3405 /// fn test_my_client() { 3406 /// let mock = Arc::new(<dyn MyService>::mock()); 3407 /// 3408 /// // directly return a success response 3409 /// let resp = FunctionResponse {...}; 3410 /// mock.myFunction.ret(resp); 3411 /// 3412 /// // or give a closure to compute the success response 3413 /// mock.myFunction.mock(|request| FunctionResponse {...}); 3414 /// 3415 /// // or throw one of the function's exceptions 3416 /// mock.myFunction.throw(StorageException::ItFailed); 3417 /// 3418 /// // or compute a Result (useful if your exceptions aren't Clone) 3419 /// mock.myFunction.mock_result(|request| Err(...)); 3420 /// 3421 /// let out = do_the_thing(mock).wait().unwrap(); 3422 /// assert!(out.what_i_expected()); 3423 /// } 3424 /// 3425 /// fn do_the_thing( 3426 /// client: Arc<dyn MyService + Send + Sync + 'static>, 3427 /// ) -> impl Future<Item = Out> {...} 3428 /// # }; 3429 /// ``` 3430 pub mod mock { 3431 pub struct MyService<'mock> { 3432 pub ping: r#impl::my_service::ping<'mock>, 3433 pub getRandomData: r#impl::my_service::getRandomData<'mock>, 3434 pub hasDataById: r#impl::my_service::hasDataById<'mock>, 3435 pub getDataById: r#impl::my_service::getDataById<'mock>, 3436 pub putDataById: r#impl::my_service::putDataById<'mock>, 3437 pub lobDataById: r#impl::my_service::lobDataById<'mock>, 3438 pub streamById: r#impl::my_service::streamById<'mock>, 3439 pub streamByIdWithException: r#impl::my_service::streamByIdWithException<'mock>, 3440 pub streamByIdWithResponse: r#impl::my_service::streamByIdWithResponse<'mock>, 3441 _marker: ::std::marker::PhantomData<&'mock ()>, 3442 } 3443 3444 impl dyn super::client::MyService { mock<'mock>() -> MyService<'mock>3445 pub fn mock<'mock>() -> MyService<'mock> { 3446 MyService { 3447 ping: r#impl::my_service::ping::unimplemented(), 3448 getRandomData: r#impl::my_service::getRandomData::unimplemented(), 3449 hasDataById: r#impl::my_service::hasDataById::unimplemented(), 3450 getDataById: r#impl::my_service::getDataById::unimplemented(), 3451 putDataById: r#impl::my_service::putDataById::unimplemented(), 3452 lobDataById: r#impl::my_service::lobDataById::unimplemented(), 3453 streamById: r#impl::my_service::streamById::unimplemented(), 3454 streamByIdWithException: r#impl::my_service::streamByIdWithException::unimplemented(), 3455 streamByIdWithResponse: r#impl::my_service::streamByIdWithResponse::unimplemented(), 3456 _marker: ::std::marker::PhantomData, 3457 } 3458 } 3459 } 3460 3461 impl<'mock> super::client::MyService for MyService<'mock> { ping( &self, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(), crate::errors::my_service::PingError>> + ::std::marker::Send + 'static>>3462 fn ping( 3463 &self, 3464 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(), crate::errors::my_service::PingError>> + ::std::marker::Send + 'static>> { 3465 let mut closure = self.ping.closure.lock().unwrap(); 3466 let closure: &mut dyn ::std::ops::FnMut() -> _ = &mut **closure; 3467 ::std::boxed::Box::pin(::futures::future::ready(closure())) 3468 } getRandomData( &self, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::string::String, crate::errors::my_service::GetRandomDataError>> + ::std::marker::Send + 'static>>3469 fn getRandomData( 3470 &self, 3471 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::string::String, crate::errors::my_service::GetRandomDataError>> + ::std::marker::Send + 'static>> { 3472 let mut closure = self.getRandomData.closure.lock().unwrap(); 3473 let closure: &mut dyn ::std::ops::FnMut() -> _ = &mut **closure; 3474 ::std::boxed::Box::pin(::futures::future::ready(closure())) 3475 } hasDataById( &self, arg_id: ::std::primitive::i64, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::primitive::bool, crate::errors::my_service::HasDataByIdError>> + ::std::marker::Send + 'static>>3476 fn hasDataById( 3477 &self, 3478 arg_id: ::std::primitive::i64, 3479 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::primitive::bool, crate::errors::my_service::HasDataByIdError>> + ::std::marker::Send + 'static>> { 3480 let mut closure = self.hasDataById.closure.lock().unwrap(); 3481 let closure: &mut dyn ::std::ops::FnMut(::std::primitive::i64) -> _ = &mut **closure; 3482 ::std::boxed::Box::pin(::futures::future::ready(closure(arg_id.clone()))) 3483 } getDataById( &self, arg_id: ::std::primitive::i64, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::string::String, crate::errors::my_service::GetDataByIdError>> + ::std::marker::Send + 'static>>3484 fn getDataById( 3485 &self, 3486 arg_id: ::std::primitive::i64, 3487 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::string::String, crate::errors::my_service::GetDataByIdError>> + ::std::marker::Send + 'static>> { 3488 let mut closure = self.getDataById.closure.lock().unwrap(); 3489 let closure: &mut dyn ::std::ops::FnMut(::std::primitive::i64) -> _ = &mut **closure; 3490 ::std::boxed::Box::pin(::futures::future::ready(closure(arg_id.clone()))) 3491 } putDataById( &self, arg_id: ::std::primitive::i64, arg_data: &::std::primitive::str, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(), crate::errors::my_service::PutDataByIdError>> + ::std::marker::Send + 'static>>3492 fn putDataById( 3493 &self, 3494 arg_id: ::std::primitive::i64, 3495 arg_data: &::std::primitive::str, 3496 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(), crate::errors::my_service::PutDataByIdError>> + ::std::marker::Send + 'static>> { 3497 let mut closure = self.putDataById.closure.lock().unwrap(); 3498 let closure: &mut dyn ::std::ops::FnMut(::std::primitive::i64, ::std::string::String) -> _ = &mut **closure; 3499 ::std::boxed::Box::pin(::futures::future::ready(closure(arg_id.clone(), arg_data.to_owned()))) 3500 } lobDataById( &self, arg_id: ::std::primitive::i64, arg_data: &::std::primitive::str, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(), crate::errors::my_service::LobDataByIdError>> + ::std::marker::Send + 'static>>3501 fn lobDataById( 3502 &self, 3503 arg_id: ::std::primitive::i64, 3504 arg_data: &::std::primitive::str, 3505 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(), crate::errors::my_service::LobDataByIdError>> + ::std::marker::Send + 'static>> { 3506 let mut closure = self.lobDataById.closure.lock().unwrap(); 3507 let closure: &mut dyn ::std::ops::FnMut(::std::primitive::i64, ::std::string::String) -> _ = &mut **closure; 3508 ::std::boxed::Box::pin(::futures::future::ready(closure(arg_id.clone(), arg_data.to_owned()))) 3509 } streamById( &self, arg_id: ::std::primitive::i64, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdStreamError>> + ::std::marker::Send + 'static >>, crate::errors::my_service::StreamByIdError>> + ::std::marker::Send + 'static>>3510 fn streamById( 3511 &self, 3512 arg_id: ::std::primitive::i64, 3513 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdStreamError>> + ::std::marker::Send + 'static >>, crate::errors::my_service::StreamByIdError>> + ::std::marker::Send + 'static>> { 3514 let mut closure = self.streamById.closure.lock().unwrap(); 3515 let closure: &mut dyn ::std::ops::FnMut(::std::primitive::i64) -> _ = &mut **closure; 3516 ::std::boxed::Box::pin(::futures::future::ready(closure(arg_id.clone()))) 3517 } streamByIdWithException( &self, arg_id: ::std::primitive::i64, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdWithExceptionStreamError>> + ::std::marker::Send + 'static >>, crate::errors::my_service::StreamByIdWithExceptionError>> + ::std::marker::Send + 'static>>3518 fn streamByIdWithException( 3519 &self, 3520 arg_id: ::std::primitive::i64, 3521 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdWithExceptionStreamError>> + ::std::marker::Send + 'static >>, crate::errors::my_service::StreamByIdWithExceptionError>> + ::std::marker::Send + 'static>> { 3522 let mut closure = self.streamByIdWithException.closure.lock().unwrap(); 3523 let closure: &mut dyn ::std::ops::FnMut(::std::primitive::i64) -> _ = &mut **closure; 3524 ::std::boxed::Box::pin(::futures::future::ready(closure(arg_id.clone()))) 3525 } streamByIdWithResponse( &self, arg_id: ::std::primitive::i64, ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(crate::types::MyDataItem, ::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdWithResponseStreamError>> + ::std::marker::Send + 'static >>), crate::errors::my_service::StreamByIdWithResponseError>> + ::std::marker::Send + 'static>>3526 fn streamByIdWithResponse( 3527 &self, 3528 arg_id: ::std::primitive::i64, 3529 ) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(crate::types::MyDataItem, ::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdWithResponseStreamError>> + ::std::marker::Send + 'static >>), crate::errors::my_service::StreamByIdWithResponseError>> + ::std::marker::Send + 'static>> { 3530 let mut closure = self.streamByIdWithResponse.closure.lock().unwrap(); 3531 let closure: &mut dyn ::std::ops::FnMut(::std::primitive::i64) -> _ = &mut **closure; 3532 ::std::boxed::Box::pin(::futures::future::ready(closure(arg_id.clone()))) 3533 } 3534 } 3535 3536 mod r#impl { 3537 pub mod my_service { 3538 3539 pub struct ping<'mock> { 3540 pub(crate) closure: ::std::sync::Mutex<::std::boxed::Box< 3541 dyn ::std::ops::FnMut() -> ::std::result::Result< 3542 (), 3543 crate::errors::my_service::PingError, 3544 > + ::std::marker::Send + ::std::marker::Sync + 'mock, 3545 >>, 3546 } 3547 3548 impl<'mock> ping<'mock> { unimplemented() -> Self3549 pub fn unimplemented() -> Self { 3550 ping { 3551 closure: ::std::sync::Mutex::new(::std::boxed::Box::new(|| panic!( 3552 "{}::{} is not mocked", 3553 "MyService", 3554 "ping", 3555 ))), 3556 } 3557 } 3558 ret(&self, value: ())3559 pub fn ret(&self, value: ()) { 3560 self.mock(move || value.clone()); 3561 } 3562 mock(&self, mut mock: impl ::std::ops::FnMut() -> () + ::std::marker::Send + ::std::marker::Sync + 'mock)3563 pub fn mock(&self, mut mock: impl ::std::ops::FnMut() -> () + ::std::marker::Send + ::std::marker::Sync + 'mock) { 3564 let mut closure = self.closure.lock().unwrap(); 3565 *closure = ::std::boxed::Box::new(move || ::std::result::Result::Ok(mock())); 3566 } 3567 mock_result(&self, mut mock: impl ::std::ops::FnMut() -> ::std::result::Result<(), crate::errors::my_service::PingError> + ::std::marker::Send + ::std::marker::Sync + 'mock)3568 pub fn mock_result(&self, mut mock: impl ::std::ops::FnMut() -> ::std::result::Result<(), crate::errors::my_service::PingError> + ::std::marker::Send + ::std::marker::Sync + 'mock) { 3569 let mut closure = self.closure.lock().unwrap(); 3570 *closure = ::std::boxed::Box::new(move || mock()); 3571 } 3572 throw<E>(&self, exception: E) where E: ::std::convert::Into<crate::errors::my_service::PingError>, E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock,3573 pub fn throw<E>(&self, exception: E) 3574 where 3575 E: ::std::convert::Into<crate::errors::my_service::PingError>, 3576 E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock, 3577 { 3578 let mut closure = self.closure.lock().unwrap(); 3579 *closure = ::std::boxed::Box::new(move || ::std::result::Result::Err(exception.clone().into())); 3580 } 3581 } 3582 3583 pub struct getRandomData<'mock> { 3584 pub(crate) closure: ::std::sync::Mutex<::std::boxed::Box< 3585 dyn ::std::ops::FnMut() -> ::std::result::Result< 3586 ::std::string::String, 3587 crate::errors::my_service::GetRandomDataError, 3588 > + ::std::marker::Send + ::std::marker::Sync + 'mock, 3589 >>, 3590 } 3591 3592 impl<'mock> getRandomData<'mock> { unimplemented() -> Self3593 pub fn unimplemented() -> Self { 3594 getRandomData { 3595 closure: ::std::sync::Mutex::new(::std::boxed::Box::new(|| panic!( 3596 "{}::{} is not mocked", 3597 "MyService", 3598 "getRandomData", 3599 ))), 3600 } 3601 } 3602 ret(&self, value: ::std::string::String)3603 pub fn ret(&self, value: ::std::string::String) { 3604 self.mock(move || value.clone()); 3605 } 3606 mock(&self, mut mock: impl ::std::ops::FnMut() -> ::std::string::String + ::std::marker::Send + ::std::marker::Sync + 'mock)3607 pub fn mock(&self, mut mock: impl ::std::ops::FnMut() -> ::std::string::String + ::std::marker::Send + ::std::marker::Sync + 'mock) { 3608 let mut closure = self.closure.lock().unwrap(); 3609 *closure = ::std::boxed::Box::new(move || ::std::result::Result::Ok(mock())); 3610 } 3611 mock_result(&self, mut mock: impl ::std::ops::FnMut() -> ::std::result::Result<::std::string::String, crate::errors::my_service::GetRandomDataError> + ::std::marker::Send + ::std::marker::Sync + 'mock)3612 pub fn mock_result(&self, mut mock: impl ::std::ops::FnMut() -> ::std::result::Result<::std::string::String, crate::errors::my_service::GetRandomDataError> + ::std::marker::Send + ::std::marker::Sync + 'mock) { 3613 let mut closure = self.closure.lock().unwrap(); 3614 *closure = ::std::boxed::Box::new(move || mock()); 3615 } 3616 throw<E>(&self, exception: E) where E: ::std::convert::Into<crate::errors::my_service::GetRandomDataError>, E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock,3617 pub fn throw<E>(&self, exception: E) 3618 where 3619 E: ::std::convert::Into<crate::errors::my_service::GetRandomDataError>, 3620 E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock, 3621 { 3622 let mut closure = self.closure.lock().unwrap(); 3623 *closure = ::std::boxed::Box::new(move || ::std::result::Result::Err(exception.clone().into())); 3624 } 3625 } 3626 3627 pub struct hasDataById<'mock> { 3628 pub(crate) closure: ::std::sync::Mutex<::std::boxed::Box< 3629 dyn ::std::ops::FnMut(::std::primitive::i64) -> ::std::result::Result< 3630 ::std::primitive::bool, 3631 crate::errors::my_service::HasDataByIdError, 3632 > + ::std::marker::Send + ::std::marker::Sync + 'mock, 3633 >>, 3634 } 3635 3636 impl<'mock> hasDataById<'mock> { unimplemented() -> Self3637 pub fn unimplemented() -> Self { 3638 hasDataById { 3639 closure: ::std::sync::Mutex::new(::std::boxed::Box::new(|_: ::std::primitive::i64| panic!( 3640 "{}::{} is not mocked", 3641 "MyService", 3642 "hasDataById", 3643 ))), 3644 } 3645 } 3646 ret(&self, value: ::std::primitive::bool)3647 pub fn ret(&self, value: ::std::primitive::bool) { 3648 self.mock(move |_: ::std::primitive::i64| value.clone()); 3649 } 3650 mock(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64) -> ::std::primitive::bool + ::std::marker::Send + ::std::marker::Sync + 'mock)3651 pub fn mock(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64) -> ::std::primitive::bool + ::std::marker::Send + ::std::marker::Sync + 'mock) { 3652 let mut closure = self.closure.lock().unwrap(); 3653 *closure = ::std::boxed::Box::new(move |id| ::std::result::Result::Ok(mock(id))); 3654 } 3655 mock_result(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64) -> ::std::result::Result<::std::primitive::bool, crate::errors::my_service::HasDataByIdError> + ::std::marker::Send + ::std::marker::Sync + 'mock)3656 pub fn mock_result(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64) -> ::std::result::Result<::std::primitive::bool, crate::errors::my_service::HasDataByIdError> + ::std::marker::Send + ::std::marker::Sync + 'mock) { 3657 let mut closure = self.closure.lock().unwrap(); 3658 *closure = ::std::boxed::Box::new(move |id| mock(id)); 3659 } 3660 throw<E>(&self, exception: E) where E: ::std::convert::Into<crate::errors::my_service::HasDataByIdError>, E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock,3661 pub fn throw<E>(&self, exception: E) 3662 where 3663 E: ::std::convert::Into<crate::errors::my_service::HasDataByIdError>, 3664 E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock, 3665 { 3666 let mut closure = self.closure.lock().unwrap(); 3667 *closure = ::std::boxed::Box::new(move |_: ::std::primitive::i64| ::std::result::Result::Err(exception.clone().into())); 3668 } 3669 } 3670 3671 pub struct getDataById<'mock> { 3672 pub(crate) closure: ::std::sync::Mutex<::std::boxed::Box< 3673 dyn ::std::ops::FnMut(::std::primitive::i64) -> ::std::result::Result< 3674 ::std::string::String, 3675 crate::errors::my_service::GetDataByIdError, 3676 > + ::std::marker::Send + ::std::marker::Sync + 'mock, 3677 >>, 3678 } 3679 3680 impl<'mock> getDataById<'mock> { unimplemented() -> Self3681 pub fn unimplemented() -> Self { 3682 getDataById { 3683 closure: ::std::sync::Mutex::new(::std::boxed::Box::new(|_: ::std::primitive::i64| panic!( 3684 "{}::{} is not mocked", 3685 "MyService", 3686 "getDataById", 3687 ))), 3688 } 3689 } 3690 ret(&self, value: ::std::string::String)3691 pub fn ret(&self, value: ::std::string::String) { 3692 self.mock(move |_: ::std::primitive::i64| value.clone()); 3693 } 3694 mock(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64) -> ::std::string::String + ::std::marker::Send + ::std::marker::Sync + 'mock)3695 pub fn mock(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64) -> ::std::string::String + ::std::marker::Send + ::std::marker::Sync + 'mock) { 3696 let mut closure = self.closure.lock().unwrap(); 3697 *closure = ::std::boxed::Box::new(move |id| ::std::result::Result::Ok(mock(id))); 3698 } 3699 mock_result(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64) -> ::std::result::Result<::std::string::String, crate::errors::my_service::GetDataByIdError> + ::std::marker::Send + ::std::marker::Sync + 'mock)3700 pub fn mock_result(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64) -> ::std::result::Result<::std::string::String, crate::errors::my_service::GetDataByIdError> + ::std::marker::Send + ::std::marker::Sync + 'mock) { 3701 let mut closure = self.closure.lock().unwrap(); 3702 *closure = ::std::boxed::Box::new(move |id| mock(id)); 3703 } 3704 throw<E>(&self, exception: E) where E: ::std::convert::Into<crate::errors::my_service::GetDataByIdError>, E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock,3705 pub fn throw<E>(&self, exception: E) 3706 where 3707 E: ::std::convert::Into<crate::errors::my_service::GetDataByIdError>, 3708 E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock, 3709 { 3710 let mut closure = self.closure.lock().unwrap(); 3711 *closure = ::std::boxed::Box::new(move |_: ::std::primitive::i64| ::std::result::Result::Err(exception.clone().into())); 3712 } 3713 } 3714 3715 pub struct putDataById<'mock> { 3716 pub(crate) closure: ::std::sync::Mutex<::std::boxed::Box< 3717 dyn ::std::ops::FnMut(::std::primitive::i64, ::std::string::String) -> ::std::result::Result< 3718 (), 3719 crate::errors::my_service::PutDataByIdError, 3720 > + ::std::marker::Send + ::std::marker::Sync + 'mock, 3721 >>, 3722 } 3723 3724 impl<'mock> putDataById<'mock> { unimplemented() -> Self3725 pub fn unimplemented() -> Self { 3726 putDataById { 3727 closure: ::std::sync::Mutex::new(::std::boxed::Box::new(|_: ::std::primitive::i64, _: ::std::string::String| panic!( 3728 "{}::{} is not mocked", 3729 "MyService", 3730 "putDataById", 3731 ))), 3732 } 3733 } 3734 ret(&self, value: ())3735 pub fn ret(&self, value: ()) { 3736 self.mock(move |_: ::std::primitive::i64, _: ::std::string::String| value.clone()); 3737 } 3738 mock(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64, ::std::string::String) -> () + ::std::marker::Send + ::std::marker::Sync + 'mock)3739 pub fn mock(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64, ::std::string::String) -> () + ::std::marker::Send + ::std::marker::Sync + 'mock) { 3740 let mut closure = self.closure.lock().unwrap(); 3741 *closure = ::std::boxed::Box::new(move |id, data| ::std::result::Result::Ok(mock(id, data))); 3742 } 3743 mock_result(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64, ::std::string::String) -> ::std::result::Result<(), crate::errors::my_service::PutDataByIdError> + ::std::marker::Send + ::std::marker::Sync + 'mock)3744 pub fn mock_result(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64, ::std::string::String) -> ::std::result::Result<(), crate::errors::my_service::PutDataByIdError> + ::std::marker::Send + ::std::marker::Sync + 'mock) { 3745 let mut closure = self.closure.lock().unwrap(); 3746 *closure = ::std::boxed::Box::new(move |id, data| mock(id, data)); 3747 } 3748 throw<E>(&self, exception: E) where E: ::std::convert::Into<crate::errors::my_service::PutDataByIdError>, E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock,3749 pub fn throw<E>(&self, exception: E) 3750 where 3751 E: ::std::convert::Into<crate::errors::my_service::PutDataByIdError>, 3752 E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock, 3753 { 3754 let mut closure = self.closure.lock().unwrap(); 3755 *closure = ::std::boxed::Box::new(move |_: ::std::primitive::i64, _: ::std::string::String| ::std::result::Result::Err(exception.clone().into())); 3756 } 3757 } 3758 3759 pub struct lobDataById<'mock> { 3760 pub(crate) closure: ::std::sync::Mutex<::std::boxed::Box< 3761 dyn ::std::ops::FnMut(::std::primitive::i64, ::std::string::String) -> ::std::result::Result< 3762 (), 3763 crate::errors::my_service::LobDataByIdError, 3764 > + ::std::marker::Send + ::std::marker::Sync + 'mock, 3765 >>, 3766 } 3767 3768 impl<'mock> lobDataById<'mock> { unimplemented() -> Self3769 pub fn unimplemented() -> Self { 3770 lobDataById { 3771 closure: ::std::sync::Mutex::new(::std::boxed::Box::new(|_: ::std::primitive::i64, _: ::std::string::String| panic!( 3772 "{}::{} is not mocked", 3773 "MyService", 3774 "lobDataById", 3775 ))), 3776 } 3777 } 3778 ret(&self, value: ())3779 pub fn ret(&self, value: ()) { 3780 self.mock(move |_: ::std::primitive::i64, _: ::std::string::String| value.clone()); 3781 } 3782 mock(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64, ::std::string::String) -> () + ::std::marker::Send + ::std::marker::Sync + 'mock)3783 pub fn mock(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64, ::std::string::String) -> () + ::std::marker::Send + ::std::marker::Sync + 'mock) { 3784 let mut closure = self.closure.lock().unwrap(); 3785 *closure = ::std::boxed::Box::new(move |id, data| ::std::result::Result::Ok(mock(id, data))); 3786 } 3787 mock_result(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64, ::std::string::String) -> ::std::result::Result<(), crate::errors::my_service::LobDataByIdError> + ::std::marker::Send + ::std::marker::Sync + 'mock)3788 pub fn mock_result(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64, ::std::string::String) -> ::std::result::Result<(), crate::errors::my_service::LobDataByIdError> + ::std::marker::Send + ::std::marker::Sync + 'mock) { 3789 let mut closure = self.closure.lock().unwrap(); 3790 *closure = ::std::boxed::Box::new(move |id, data| mock(id, data)); 3791 } 3792 throw<E>(&self, exception: E) where E: ::std::convert::Into<crate::errors::my_service::LobDataByIdError>, E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock,3793 pub fn throw<E>(&self, exception: E) 3794 where 3795 E: ::std::convert::Into<crate::errors::my_service::LobDataByIdError>, 3796 E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock, 3797 { 3798 let mut closure = self.closure.lock().unwrap(); 3799 *closure = ::std::boxed::Box::new(move |_: ::std::primitive::i64, _: ::std::string::String| ::std::result::Result::Err(exception.clone().into())); 3800 } 3801 } 3802 3803 pub struct streamById<'mock> { 3804 pub(crate) closure: ::std::sync::Mutex<::std::boxed::Box< 3805 dyn ::std::ops::FnMut(::std::primitive::i64) -> ::std::result::Result< 3806 ::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdStreamError>> + ::std::marker::Send + 'static >>, 3807 crate::errors::my_service::StreamByIdError, 3808 > + ::std::marker::Send + ::std::marker::Sync + 'mock, 3809 >>, 3810 } 3811 3812 impl<'mock> streamById<'mock> { unimplemented() -> Self3813 pub fn unimplemented() -> Self { 3814 streamById { 3815 closure: ::std::sync::Mutex::new(::std::boxed::Box::new(|_: ::std::primitive::i64| panic!( 3816 "{}::{} is not mocked", 3817 "MyService", 3818 "streamById", 3819 ))), 3820 } 3821 } 3822 ret(&self, _value: ::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdStreamError>> + ::std::marker::Send + 'static >>)3823 pub fn ret(&self, _value: ::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdStreamError>> + ::std::marker::Send + 'static >>) { 3824 unimplemented!("Mocking streams is not yet implemented, as value isn't cloneable") 3825 } 3826 mock(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64) -> ::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdStreamError>> + ::std::marker::Send + 'static >> + ::std::marker::Send + ::std::marker::Sync + 'mock)3827 pub fn mock(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64) -> ::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdStreamError>> + ::std::marker::Send + 'static >> + ::std::marker::Send + ::std::marker::Sync + 'mock) { 3828 let mut closure = self.closure.lock().unwrap(); 3829 *closure = ::std::boxed::Box::new(move |id| ::std::result::Result::Ok(mock(id))); 3830 } 3831 mock_result(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64) -> ::std::result::Result<::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdStreamError>> + ::std::marker::Send + 'static >>, crate::errors::my_service::StreamByIdError> + ::std::marker::Send + ::std::marker::Sync + 'mock)3832 pub fn mock_result(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64) -> ::std::result::Result<::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdStreamError>> + ::std::marker::Send + 'static >>, crate::errors::my_service::StreamByIdError> + ::std::marker::Send + ::std::marker::Sync + 'mock) { 3833 let mut closure = self.closure.lock().unwrap(); 3834 *closure = ::std::boxed::Box::new(move |id| mock(id)); 3835 } 3836 throw<E>(&self, exception: E) where E: ::std::convert::Into<crate::errors::my_service::StreamByIdError>, E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock,3837 pub fn throw<E>(&self, exception: E) 3838 where 3839 E: ::std::convert::Into<crate::errors::my_service::StreamByIdError>, 3840 E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock, 3841 { 3842 let mut closure = self.closure.lock().unwrap(); 3843 *closure = ::std::boxed::Box::new(move |_: ::std::primitive::i64| ::std::result::Result::Err(exception.clone().into())); 3844 } 3845 } 3846 3847 pub struct streamByIdWithException<'mock> { 3848 pub(crate) closure: ::std::sync::Mutex<::std::boxed::Box< 3849 dyn ::std::ops::FnMut(::std::primitive::i64) -> ::std::result::Result< 3850 ::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdWithExceptionStreamError>> + ::std::marker::Send + 'static >>, 3851 crate::errors::my_service::StreamByIdWithExceptionError, 3852 > + ::std::marker::Send + ::std::marker::Sync + 'mock, 3853 >>, 3854 } 3855 3856 impl<'mock> streamByIdWithException<'mock> { unimplemented() -> Self3857 pub fn unimplemented() -> Self { 3858 streamByIdWithException { 3859 closure: ::std::sync::Mutex::new(::std::boxed::Box::new(|_: ::std::primitive::i64| panic!( 3860 "{}::{} is not mocked", 3861 "MyService", 3862 "streamByIdWithException", 3863 ))), 3864 } 3865 } 3866 ret(&self, _value: ::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdWithExceptionStreamError>> + ::std::marker::Send + 'static >>)3867 pub fn ret(&self, _value: ::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdWithExceptionStreamError>> + ::std::marker::Send + 'static >>) { 3868 unimplemented!("Mocking streams is not yet implemented, as value isn't cloneable") 3869 } 3870 mock(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64) -> ::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdWithExceptionStreamError>> + ::std::marker::Send + 'static >> + ::std::marker::Send + ::std::marker::Sync + 'mock)3871 pub fn mock(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64) -> ::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdWithExceptionStreamError>> + ::std::marker::Send + 'static >> + ::std::marker::Send + ::std::marker::Sync + 'mock) { 3872 let mut closure = self.closure.lock().unwrap(); 3873 *closure = ::std::boxed::Box::new(move |id| ::std::result::Result::Ok(mock(id))); 3874 } 3875 mock_result(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64) -> ::std::result::Result<::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdWithExceptionStreamError>> + ::std::marker::Send + 'static >>, crate::errors::my_service::StreamByIdWithExceptionError> + ::std::marker::Send + ::std::marker::Sync + 'mock)3876 pub fn mock_result(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64) -> ::std::result::Result<::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdWithExceptionStreamError>> + ::std::marker::Send + 'static >>, crate::errors::my_service::StreamByIdWithExceptionError> + ::std::marker::Send + ::std::marker::Sync + 'mock) { 3877 let mut closure = self.closure.lock().unwrap(); 3878 *closure = ::std::boxed::Box::new(move |id| mock(id)); 3879 } 3880 throw<E>(&self, exception: E) where E: ::std::convert::Into<crate::errors::my_service::StreamByIdWithExceptionError>, E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock,3881 pub fn throw<E>(&self, exception: E) 3882 where 3883 E: ::std::convert::Into<crate::errors::my_service::StreamByIdWithExceptionError>, 3884 E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock, 3885 { 3886 let mut closure = self.closure.lock().unwrap(); 3887 *closure = ::std::boxed::Box::new(move |_: ::std::primitive::i64| ::std::result::Result::Err(exception.clone().into())); 3888 } 3889 } 3890 3891 pub struct streamByIdWithResponse<'mock> { 3892 pub(crate) closure: ::std::sync::Mutex<::std::boxed::Box< 3893 dyn ::std::ops::FnMut(::std::primitive::i64) -> ::std::result::Result< 3894 (crate::types::MyDataItem, ::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdWithResponseStreamError>> + ::std::marker::Send + 'static >>), 3895 crate::errors::my_service::StreamByIdWithResponseError, 3896 > + ::std::marker::Send + ::std::marker::Sync + 'mock, 3897 >>, 3898 } 3899 3900 impl<'mock> streamByIdWithResponse<'mock> { unimplemented() -> Self3901 pub fn unimplemented() -> Self { 3902 streamByIdWithResponse { 3903 closure: ::std::sync::Mutex::new(::std::boxed::Box::new(|_: ::std::primitive::i64| panic!( 3904 "{}::{} is not mocked", 3905 "MyService", 3906 "streamByIdWithResponse", 3907 ))), 3908 } 3909 } 3910 ret(&self, _value: (crate::types::MyDataItem, ::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdWithResponseStreamError>> + ::std::marker::Send + 'static >>))3911 pub fn ret(&self, _value: (crate::types::MyDataItem, ::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdWithResponseStreamError>> + ::std::marker::Send + 'static >>)) { 3912 unimplemented!("Mocking streams is not yet implemented, as value isn't cloneable") 3913 } 3914 mock(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64) -> (crate::types::MyDataItem, ::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdWithResponseStreamError>> + ::std::marker::Send + 'static >>) + ::std::marker::Send + ::std::marker::Sync + 'mock)3915 pub fn mock(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64) -> (crate::types::MyDataItem, ::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdWithResponseStreamError>> + ::std::marker::Send + 'static >>) + ::std::marker::Send + ::std::marker::Sync + 'mock) { 3916 let mut closure = self.closure.lock().unwrap(); 3917 *closure = ::std::boxed::Box::new(move |id| ::std::result::Result::Ok(mock(id))); 3918 } 3919 mock_result(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64) -> ::std::result::Result<(crate::types::MyDataItem, ::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdWithResponseStreamError>> + ::std::marker::Send + 'static >>), crate::errors::my_service::StreamByIdWithResponseError> + ::std::marker::Send + ::std::marker::Sync + 'mock)3920 pub fn mock_result(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64) -> ::std::result::Result<(crate::types::MyDataItem, ::std::pin::Pin<::std::boxed::Box<dyn ::futures::stream::Stream< Item = ::std::result::Result<crate::types::MyStruct, crate::errors::my_service::StreamByIdWithResponseStreamError>> + ::std::marker::Send + 'static >>), crate::errors::my_service::StreamByIdWithResponseError> + ::std::marker::Send + ::std::marker::Sync + 'mock) { 3921 let mut closure = self.closure.lock().unwrap(); 3922 *closure = ::std::boxed::Box::new(move |id| mock(id)); 3923 } 3924 throw<E>(&self, exception: E) where E: ::std::convert::Into<crate::errors::my_service::StreamByIdWithResponseError>, E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock,3925 pub fn throw<E>(&self, exception: E) 3926 where 3927 E: ::std::convert::Into<crate::errors::my_service::StreamByIdWithResponseError>, 3928 E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock, 3929 { 3930 let mut closure = self.closure.lock().unwrap(); 3931 *closure = ::std::boxed::Box::new(move |_: ::std::primitive::i64| ::std::result::Result::Err(exception.clone().into())); 3932 } 3933 } 3934 } 3935 } 3936 } 3937 3938 /// Error return types. 3939 pub mod errors { 3940 /// Errors for MyService functions. 3941 pub mod my_service { 3942 3943 pub type PingError = ::fbthrift::NonthrowingFunctionError; 3944 3945 impl ::std::convert::From<crate::services::my_service::PingExn> for 3946 ::std::result::Result<(), PingError> 3947 { from(e: crate::services::my_service::PingExn) -> Self3948 fn from(e: crate::services::my_service::PingExn) -> Self { 3949 match e { 3950 crate::services::my_service::PingExn::Success(res) => 3951 ::std::result::Result::Ok(res), 3952 crate::services::my_service::PingExn::ApplicationException(aexn) => 3953 ::std::result::Result::Err(PingError::ApplicationException(aexn)), 3954 } 3955 } 3956 } 3957 3958 pub type GetRandomDataError = ::fbthrift::NonthrowingFunctionError; 3959 3960 impl ::std::convert::From<crate::services::my_service::GetRandomDataExn> for 3961 ::std::result::Result<::std::string::String, GetRandomDataError> 3962 { from(e: crate::services::my_service::GetRandomDataExn) -> Self3963 fn from(e: crate::services::my_service::GetRandomDataExn) -> Self { 3964 match e { 3965 crate::services::my_service::GetRandomDataExn::Success(res) => 3966 ::std::result::Result::Ok(res), 3967 crate::services::my_service::GetRandomDataExn::ApplicationException(aexn) => 3968 ::std::result::Result::Err(GetRandomDataError::ApplicationException(aexn)), 3969 } 3970 } 3971 } 3972 3973 pub type HasDataByIdError = ::fbthrift::NonthrowingFunctionError; 3974 3975 impl ::std::convert::From<crate::services::my_service::HasDataByIdExn> for 3976 ::std::result::Result<::std::primitive::bool, HasDataByIdError> 3977 { from(e: crate::services::my_service::HasDataByIdExn) -> Self3978 fn from(e: crate::services::my_service::HasDataByIdExn) -> Self { 3979 match e { 3980 crate::services::my_service::HasDataByIdExn::Success(res) => 3981 ::std::result::Result::Ok(res), 3982 crate::services::my_service::HasDataByIdExn::ApplicationException(aexn) => 3983 ::std::result::Result::Err(HasDataByIdError::ApplicationException(aexn)), 3984 } 3985 } 3986 } 3987 3988 pub type GetDataByIdError = ::fbthrift::NonthrowingFunctionError; 3989 3990 impl ::std::convert::From<crate::services::my_service::GetDataByIdExn> for 3991 ::std::result::Result<::std::string::String, GetDataByIdError> 3992 { from(e: crate::services::my_service::GetDataByIdExn) -> Self3993 fn from(e: crate::services::my_service::GetDataByIdExn) -> Self { 3994 match e { 3995 crate::services::my_service::GetDataByIdExn::Success(res) => 3996 ::std::result::Result::Ok(res), 3997 crate::services::my_service::GetDataByIdExn::ApplicationException(aexn) => 3998 ::std::result::Result::Err(GetDataByIdError::ApplicationException(aexn)), 3999 } 4000 } 4001 } 4002 4003 pub type PutDataByIdError = ::fbthrift::NonthrowingFunctionError; 4004 4005 impl ::std::convert::From<crate::services::my_service::PutDataByIdExn> for 4006 ::std::result::Result<(), PutDataByIdError> 4007 { from(e: crate::services::my_service::PutDataByIdExn) -> Self4008 fn from(e: crate::services::my_service::PutDataByIdExn) -> Self { 4009 match e { 4010 crate::services::my_service::PutDataByIdExn::Success(res) => 4011 ::std::result::Result::Ok(res), 4012 crate::services::my_service::PutDataByIdExn::ApplicationException(aexn) => 4013 ::std::result::Result::Err(PutDataByIdError::ApplicationException(aexn)), 4014 } 4015 } 4016 } 4017 4018 pub type LobDataByIdError = ::fbthrift::NonthrowingFunctionError; 4019 4020 impl ::std::convert::From<crate::services::my_service::LobDataByIdExn> for 4021 ::std::result::Result<(), LobDataByIdError> 4022 { from(e: crate::services::my_service::LobDataByIdExn) -> Self4023 fn from(e: crate::services::my_service::LobDataByIdExn) -> Self { 4024 match e { 4025 crate::services::my_service::LobDataByIdExn::Success(res) => 4026 ::std::result::Result::Ok(res), 4027 crate::services::my_service::LobDataByIdExn::ApplicationException(aexn) => 4028 ::std::result::Result::Err(LobDataByIdError::ApplicationException(aexn)), 4029 } 4030 } 4031 } 4032 4033 pub type StreamByIdError = ::fbthrift::NonthrowingFunctionError; 4034 4035 pub type StreamByIdStreamError = ::fbthrift::NonthrowingFunctionError; 4036 4037 impl ::std::convert::From<crate::services::my_service::StreamByIdStreamExn> for 4038 ::std::result::Result<crate::types::MyStruct, StreamByIdStreamError> 4039 { from(e: crate::services::my_service::StreamByIdStreamExn) -> Self4040 fn from(e: crate::services::my_service::StreamByIdStreamExn) -> Self { 4041 match e { 4042 crate::services::my_service::StreamByIdStreamExn::Success(res) => 4043 ::std::result::Result::Ok(res), 4044 crate::services::my_service::StreamByIdStreamExn::ApplicationException(aexn) => 4045 ::std::result::Result::Err(StreamByIdStreamError::ApplicationException(aexn)), 4046 } 4047 } 4048 } 4049 4050 pub type StreamByIdWithExceptionError = ::fbthrift::NonthrowingFunctionError; 4051 4052 #[derive(Debug, ::thiserror::Error)] 4053 pub enum StreamByIdWithExceptionStreamError { 4054 #[error("MyService::streamByIdWithException stream failed with {0:?}")] 4055 e(crate::types::MyException), 4056 #[error("Application exception: {0:?}")] 4057 ApplicationException(::fbthrift::types::ApplicationException), 4058 #[error("{0}")] 4059 ThriftError(::anyhow::Error), 4060 } 4061 4062 impl ::std::convert::From<crate::types::MyException> for StreamByIdWithExceptionStreamError { from(e: crate::types::MyException) -> Self4063 fn from(e: crate::types::MyException) -> Self { 4064 StreamByIdWithExceptionStreamError::e(e) 4065 } 4066 } 4067 4068 impl ::std::convert::From<::anyhow::Error> for StreamByIdWithExceptionStreamError { from(err: ::anyhow::Error) -> Self4069 fn from(err: ::anyhow::Error) -> Self { 4070 StreamByIdWithExceptionStreamError::ThriftError(err) 4071 } 4072 } 4073 4074 impl ::std::convert::From<::fbthrift::ApplicationException> for StreamByIdWithExceptionStreamError { from(ae: ::fbthrift::ApplicationException) -> Self4075 fn from(ae: ::fbthrift::ApplicationException) -> Self { 4076 StreamByIdWithExceptionStreamError::ApplicationException(ae) 4077 } 4078 } 4079 4080 impl ::std::convert::From<crate::services::my_service::StreamByIdWithExceptionStreamExn> for 4081 ::std::result::Result<crate::types::MyStruct, StreamByIdWithExceptionStreamError> 4082 { from(e: crate::services::my_service::StreamByIdWithExceptionStreamExn) -> Self4083 fn from(e: crate::services::my_service::StreamByIdWithExceptionStreamExn) -> Self { 4084 match e { 4085 crate::services::my_service::StreamByIdWithExceptionStreamExn::Success(res) => 4086 ::std::result::Result::Ok(res), 4087 crate::services::my_service::StreamByIdWithExceptionStreamExn::ApplicationException(aexn) => 4088 ::std::result::Result::Err(StreamByIdWithExceptionStreamError::ApplicationException(aexn)), 4089 crate::services::my_service::StreamByIdWithExceptionStreamExn::e(exn) => 4090 ::std::result::Result::Err(StreamByIdWithExceptionStreamError::e(exn)), 4091 } 4092 } 4093 } 4094 4095 pub type StreamByIdWithResponseError = ::fbthrift::NonthrowingFunctionError; 4096 4097 impl ::std::convert::From<crate::services::my_service::StreamByIdWithResponseExn> for 4098 ::std::result::Result<crate::types::MyDataItem, StreamByIdWithResponseError> 4099 { from(e: crate::services::my_service::StreamByIdWithResponseExn) -> Self4100 fn from(e: crate::services::my_service::StreamByIdWithResponseExn) -> Self { 4101 match e { 4102 crate::services::my_service::StreamByIdWithResponseExn::Success(res) => 4103 ::std::result::Result::Ok(res), 4104 crate::services::my_service::StreamByIdWithResponseExn::ApplicationException(aexn) => 4105 ::std::result::Result::Err(StreamByIdWithResponseError::ApplicationException(aexn)), 4106 } 4107 } 4108 } 4109 4110 pub type StreamByIdWithResponseStreamError = ::fbthrift::NonthrowingFunctionError; 4111 4112 impl ::std::convert::From<crate::services::my_service::StreamByIdWithResponseStreamExn> for 4113 ::std::result::Result<crate::types::MyStruct, StreamByIdWithResponseStreamError> 4114 { from(e: crate::services::my_service::StreamByIdWithResponseStreamExn) -> Self4115 fn from(e: crate::services::my_service::StreamByIdWithResponseStreamExn) -> Self { 4116 match e { 4117 crate::services::my_service::StreamByIdWithResponseStreamExn::Success(res) => 4118 ::std::result::Result::Ok(res), 4119 crate::services::my_service::StreamByIdWithResponseStreamExn::ApplicationException(aexn) => 4120 ::std::result::Result::Err(StreamByIdWithResponseStreamError::ApplicationException(aexn)), 4121 } 4122 } 4123 } 4124 4125 } 4126 4127 } 4128