pubsub.rs 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. // This file is generated by rust-protobuf 2.8.0. Do not edit
  2. // @generated
  3. // https://github.com/Manishearth/rust-clippy/issues/702
  4. #![allow(unknown_lints)]
  5. #![allow(clippy::all)]
  6. #![cfg_attr(rustfmt, rustfmt_skip)]
  7. #![allow(box_pointers)]
  8. #![allow(dead_code)]
  9. #![allow(missing_docs)]
  10. #![allow(non_camel_case_types)]
  11. #![allow(non_snake_case)]
  12. #![allow(non_upper_case_globals)]
  13. #![allow(trivial_casts)]
  14. #![allow(unsafe_code)]
  15. #![allow(unused_imports)]
  16. #![allow(unused_results)]
  17. //! Generated file from `pubsub.proto`
  18. use protobuf::Message as Message_imported_for_functions;
  19. use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
  20. /// Generated files are compatible only with the same version
  21. /// of protobuf runtime.
  22. const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_8_0;
  23. #[derive(PartialEq,Clone,Default)]
  24. pub struct Subscription {
  25. // message fields
  26. uri: ::protobuf::SingularField<::std::string::String>,
  27. expiry: ::std::option::Option<i32>,
  28. status_code: ::std::option::Option<i32>,
  29. // special fields
  30. pub unknown_fields: ::protobuf::UnknownFields,
  31. pub cached_size: ::protobuf::CachedSize,
  32. }
  33. impl<'a> ::std::default::Default for &'a Subscription {
  34. fn default() -> &'a Subscription {
  35. <Subscription as ::protobuf::Message>::default_instance()
  36. }
  37. }
  38. impl Subscription {
  39. pub fn new() -> Subscription {
  40. ::std::default::Default::default()
  41. }
  42. // optional string uri = 1;
  43. pub fn get_uri(&self) -> &str {
  44. match self.uri.as_ref() {
  45. Some(v) => &v,
  46. None => "",
  47. }
  48. }
  49. pub fn clear_uri(&mut self) {
  50. self.uri.clear();
  51. }
  52. pub fn has_uri(&self) -> bool {
  53. self.uri.is_some()
  54. }
  55. // Param is passed by value, moved
  56. pub fn set_uri(&mut self, v: ::std::string::String) {
  57. self.uri = ::protobuf::SingularField::some(v);
  58. }
  59. // Mutable pointer to the field.
  60. // If field is not initialized, it is initialized with default value first.
  61. pub fn mut_uri(&mut self) -> &mut ::std::string::String {
  62. if self.uri.is_none() {
  63. self.uri.set_default();
  64. }
  65. self.uri.as_mut().unwrap()
  66. }
  67. // Take field
  68. pub fn take_uri(&mut self) -> ::std::string::String {
  69. self.uri.take().unwrap_or_else(|| ::std::string::String::new())
  70. }
  71. // optional int32 expiry = 2;
  72. pub fn get_expiry(&self) -> i32 {
  73. self.expiry.unwrap_or(0)
  74. }
  75. pub fn clear_expiry(&mut self) {
  76. self.expiry = ::std::option::Option::None;
  77. }
  78. pub fn has_expiry(&self) -> bool {
  79. self.expiry.is_some()
  80. }
  81. // Param is passed by value, moved
  82. pub fn set_expiry(&mut self, v: i32) {
  83. self.expiry = ::std::option::Option::Some(v);
  84. }
  85. // optional int32 status_code = 3;
  86. pub fn get_status_code(&self) -> i32 {
  87. self.status_code.unwrap_or(0)
  88. }
  89. pub fn clear_status_code(&mut self) {
  90. self.status_code = ::std::option::Option::None;
  91. }
  92. pub fn has_status_code(&self) -> bool {
  93. self.status_code.is_some()
  94. }
  95. // Param is passed by value, moved
  96. pub fn set_status_code(&mut self, v: i32) {
  97. self.status_code = ::std::option::Option::Some(v);
  98. }
  99. }
  100. impl ::protobuf::Message for Subscription {
  101. fn is_initialized(&self) -> bool {
  102. true
  103. }
  104. fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> {
  105. while !is.eof()? {
  106. let (field_number, wire_type) = is.read_tag_unpack()?;
  107. match field_number {
  108. 1 => {
  109. ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.uri)?;
  110. },
  111. 2 => {
  112. if wire_type != ::protobuf::wire_format::WireTypeVarint {
  113. return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
  114. }
  115. let tmp = is.read_int32()?;
  116. self.expiry = ::std::option::Option::Some(tmp);
  117. },
  118. 3 => {
  119. if wire_type != ::protobuf::wire_format::WireTypeVarint {
  120. return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
  121. }
  122. let tmp = is.read_int32()?;
  123. self.status_code = ::std::option::Option::Some(tmp);
  124. },
  125. _ => {
  126. ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
  127. },
  128. };
  129. }
  130. ::std::result::Result::Ok(())
  131. }
  132. // Compute sizes of nested messages
  133. #[allow(unused_variables)]
  134. fn compute_size(&self) -> u32 {
  135. let mut my_size = 0;
  136. if let Some(ref v) = self.uri.as_ref() {
  137. my_size += ::protobuf::rt::string_size(1, &v);
  138. }
  139. if let Some(v) = self.expiry {
  140. my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint);
  141. }
  142. if let Some(v) = self.status_code {
  143. my_size += ::protobuf::rt::value_size(3, v, ::protobuf::wire_format::WireTypeVarint);
  144. }
  145. my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
  146. self.cached_size.set(my_size);
  147. my_size
  148. }
  149. fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> {
  150. if let Some(ref v) = self.uri.as_ref() {
  151. os.write_string(1, &v)?;
  152. }
  153. if let Some(v) = self.expiry {
  154. os.write_int32(2, v)?;
  155. }
  156. if let Some(v) = self.status_code {
  157. os.write_int32(3, v)?;
  158. }
  159. os.write_unknown_fields(self.get_unknown_fields())?;
  160. ::std::result::Result::Ok(())
  161. }
  162. fn get_cached_size(&self) -> u32 {
  163. self.cached_size.get()
  164. }
  165. fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
  166. &self.unknown_fields
  167. }
  168. fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
  169. &mut self.unknown_fields
  170. }
  171. fn as_any(&self) -> &dyn (::std::any::Any) {
  172. self as &dyn (::std::any::Any)
  173. }
  174. fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
  175. self as &mut dyn (::std::any::Any)
  176. }
  177. fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
  178. self
  179. }
  180. fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
  181. Self::descriptor_static()
  182. }
  183. fn new() -> Subscription {
  184. Subscription::new()
  185. }
  186. fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
  187. static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy {
  188. lock: ::protobuf::lazy::ONCE_INIT,
  189. ptr: 0 as *const ::protobuf::reflect::MessageDescriptor,
  190. };
  191. unsafe {
  192. descriptor.get(|| {
  193. let mut fields = ::std::vec::Vec::new();
  194. fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
  195. "uri",
  196. |m: &Subscription| { &m.uri },
  197. |m: &mut Subscription| { &mut m.uri },
  198. ));
  199. fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeInt32>(
  200. "expiry",
  201. |m: &Subscription| { &m.expiry },
  202. |m: &mut Subscription| { &mut m.expiry },
  203. ));
  204. fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeInt32>(
  205. "status_code",
  206. |m: &Subscription| { &m.status_code },
  207. |m: &mut Subscription| { &mut m.status_code },
  208. ));
  209. ::protobuf::reflect::MessageDescriptor::new::<Subscription>(
  210. "Subscription",
  211. fields,
  212. file_descriptor_proto()
  213. )
  214. })
  215. }
  216. }
  217. fn default_instance() -> &'static Subscription {
  218. static mut instance: ::protobuf::lazy::Lazy<Subscription> = ::protobuf::lazy::Lazy {
  219. lock: ::protobuf::lazy::ONCE_INIT,
  220. ptr: 0 as *const Subscription,
  221. };
  222. unsafe {
  223. instance.get(Subscription::new)
  224. }
  225. }
  226. }
  227. impl ::protobuf::Clear for Subscription {
  228. fn clear(&mut self) {
  229. self.uri.clear();
  230. self.expiry = ::std::option::Option::None;
  231. self.status_code = ::std::option::Option::None;
  232. self.unknown_fields.clear();
  233. }
  234. }
  235. impl ::std::fmt::Debug for Subscription {
  236. fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
  237. ::protobuf::text_format::fmt(self, f)
  238. }
  239. }
  240. impl ::protobuf::reflect::ProtobufValue for Subscription {
  241. fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
  242. ::protobuf::reflect::ProtobufValueRef::Message(self)
  243. }
  244. }
  245. static file_descriptor_proto_data: &'static [u8] = b"\
  246. \n\x0cpubsub.proto\x12\0\"H\n\x0cSubscription\x12\r\n\x03uri\x18\x01\x20\
  247. \x01(\tB\0\x12\x10\n\x06expiry\x18\x02\x20\x01(\x05B\0\x12\x15\n\x0bstat\
  248. us_code\x18\x03\x20\x01(\x05B\0:\0B\0b\x06proto2\
  249. ";
  250. static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy {
  251. lock: ::protobuf::lazy::ONCE_INIT,
  252. ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto,
  253. };
  254. fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
  255. ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
  256. }
  257. pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
  258. unsafe {
  259. file_descriptor_proto_lazy.get(|| {
  260. parse_descriptor_proto()
  261. })
  262. }
  263. }