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 include!("impl_my_things.rs");
7 include!("my/other/thing.rs");
8 
9 pub use self::errors::*;
10 pub use self::types::*;
11 
12 /// Thrift type definitions for `module`.
13 pub mod types {
14     #![allow(clippy::redundant_closure)]
15 
16 
17     #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
18     pub struct MyStruct {
19         pub foo: ::std::primitive::i32,
20         pub bar: ::std::string::String,
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     impl ::std::default::Default for self::MyStruct {
default() -> Self30         fn default() -> Self {
31             Self {
32                 foo: ::std::default::Default::default(),
33                 bar: ::std::default::Default::default(),
34                 _dot_dot_Default_default: self::dot_dot::OtherFields(()),
35             }
36         }
37     }
38 
39     impl ::std::fmt::Debug for self::MyStruct {
fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result40         fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
41             formatter
42                 .debug_struct("MyStruct")
43                 .field("foo", &self.foo)
44                 .field("bar", &self.bar)
45                 .finish()
46         }
47     }
48 
49     unsafe impl ::std::marker::Send for self::MyStruct {}
50     unsafe impl ::std::marker::Sync for self::MyStruct {}
51 
52     impl ::fbthrift::GetTType for self::MyStruct {
53         const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
54     }
55 
56     impl<P> ::fbthrift::Serialize<P> for self::MyStruct
57     where
58         P: ::fbthrift::ProtocolWriter,
59     {
write(&self, p: &mut P)60         fn write(&self, p: &mut P) {
61             p.write_struct_begin("MyStruct");
62             p.write_field_begin("foo", ::fbthrift::TType::I32, 1);
63             ::fbthrift::Serialize::write(&self.foo, p);
64             p.write_field_end();
65             p.write_field_begin("bar", ::fbthrift::TType::String, 2);
66             ::fbthrift::Serialize::write(&self.bar, p);
67             p.write_field_end();
68             p.write_field_stop();
69             p.write_struct_end();
70         }
71     }
72 
73     impl<P> ::fbthrift::Deserialize<P> for self::MyStruct
74     where
75         P: ::fbthrift::ProtocolReader,
76     {
read(p: &mut P) -> ::anyhow::Result<Self>77         fn read(p: &mut P) -> ::anyhow::Result<Self> {
78             static FIELDS: &[::fbthrift::Field] = &[
79                 ::fbthrift::Field::new("bar", ::fbthrift::TType::String, 2),
80                 ::fbthrift::Field::new("foo", ::fbthrift::TType::I32, 1),
81             ];
82             let mut field_foo = ::std::option::Option::None;
83             let mut field_bar = ::std::option::Option::None;
84             let _ = p.read_struct_begin(|_| ())?;
85             loop {
86                 let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
87                 match (fty, fid as ::std::primitive::i32) {
88                     (::fbthrift::TType::Stop, _) => break,
89                     (::fbthrift::TType::I32, 1) => field_foo = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
90                     (::fbthrift::TType::String, 2) => field_bar = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
91                     (fty, _) => p.skip(fty)?,
92                 }
93                 p.read_field_end()?;
94             }
95             p.read_struct_end()?;
96             ::std::result::Result::Ok(Self {
97                 foo: field_foo.unwrap_or_default(),
98                 bar: field_bar.unwrap_or_default(),
99                 _dot_dot_Default_default: self::dot_dot::OtherFields(()),
100             })
101         }
102     }
103 
104 
105     mod dot_dot {
106         #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
107         pub struct OtherFields(pub(crate) ());
108     }
109 }
110 
111 /// Error return types.
112 pub mod errors {
113 }
114