pubsub.rs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. // This file is generated. Do not edit
  2. // @generated
  3. // https://github.com/Manishearth/rust-clippy/issues/702
  4. #![allow(unknown_lints)]
  5. #![allow(clippy)]
  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. use protobuf::Message as Message_imported_for_functions;
  18. use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
  19. #[derive(PartialEq,Clone,Default)]
  20. pub struct Subscription {
  21. // message fields
  22. uri: ::protobuf::SingularField<::std::string::String>,
  23. expiry: ::std::option::Option<i32>,
  24. status_code: ::std::option::Option<i32>,
  25. // special fields
  26. unknown_fields: ::protobuf::UnknownFields,
  27. cached_size: ::protobuf::CachedSize,
  28. }
  29. // see codegen.rs for the explanation why impl Sync explicitly
  30. unsafe impl ::std::marker::Sync for Subscription {}
  31. impl Subscription {
  32. pub fn new() -> Subscription {
  33. ::std::default::Default::default()
  34. }
  35. pub fn default_instance() -> &'static Subscription {
  36. static mut instance: ::protobuf::lazy::Lazy<Subscription> = ::protobuf::lazy::Lazy {
  37. lock: ::protobuf::lazy::ONCE_INIT,
  38. ptr: 0 as *const Subscription,
  39. };
  40. unsafe {
  41. instance.get(Subscription::new)
  42. }
  43. }
  44. // optional string uri = 1;
  45. pub fn clear_uri(&mut self) {
  46. self.uri.clear();
  47. }
  48. pub fn has_uri(&self) -> bool {
  49. self.uri.is_some()
  50. }
  51. // Param is passed by value, moved
  52. pub fn set_uri(&mut self, v: ::std::string::String) {
  53. self.uri = ::protobuf::SingularField::some(v);
  54. }
  55. // Mutable pointer to the field.
  56. // If field is not initialized, it is initialized with default value first.
  57. pub fn mut_uri(&mut self) -> &mut ::std::string::String {
  58. if self.uri.is_none() {
  59. self.uri.set_default();
  60. };
  61. self.uri.as_mut().unwrap()
  62. }
  63. // Take field
  64. pub fn take_uri(&mut self) -> ::std::string::String {
  65. self.uri.take().unwrap_or_else(|| ::std::string::String::new())
  66. }
  67. pub fn get_uri(&self) -> &str {
  68. match self.uri.as_ref() {
  69. Some(v) => &v,
  70. None => "",
  71. }
  72. }
  73. fn get_uri_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> {
  74. &self.uri
  75. }
  76. fn mut_uri_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> {
  77. &mut self.uri
  78. }
  79. // optional int32 expiry = 2;
  80. pub fn clear_expiry(&mut self) {
  81. self.expiry = ::std::option::Option::None;
  82. }
  83. pub fn has_expiry(&self) -> bool {
  84. self.expiry.is_some()
  85. }
  86. // Param is passed by value, moved
  87. pub fn set_expiry(&mut self, v: i32) {
  88. self.expiry = ::std::option::Option::Some(v);
  89. }
  90. pub fn get_expiry(&self) -> i32 {
  91. self.expiry.unwrap_or(0)
  92. }
  93. fn get_expiry_for_reflect(&self) -> &::std::option::Option<i32> {
  94. &self.expiry
  95. }
  96. fn mut_expiry_for_reflect(&mut self) -> &mut ::std::option::Option<i32> {
  97. &mut self.expiry
  98. }
  99. // optional int32 status_code = 3;
  100. pub fn clear_status_code(&mut self) {
  101. self.status_code = ::std::option::Option::None;
  102. }
  103. pub fn has_status_code(&self) -> bool {
  104. self.status_code.is_some()
  105. }
  106. // Param is passed by value, moved
  107. pub fn set_status_code(&mut self, v: i32) {
  108. self.status_code = ::std::option::Option::Some(v);
  109. }
  110. pub fn get_status_code(&self) -> i32 {
  111. self.status_code.unwrap_or(0)
  112. }
  113. fn get_status_code_for_reflect(&self) -> &::std::option::Option<i32> {
  114. &self.status_code
  115. }
  116. fn mut_status_code_for_reflect(&mut self) -> &mut ::std::option::Option<i32> {
  117. &mut self.status_code
  118. }
  119. }
  120. impl ::protobuf::Message for Subscription {
  121. fn is_initialized(&self) -> bool {
  122. true
  123. }
  124. fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> {
  125. while !is.eof()? {
  126. let (field_number, wire_type) = is.read_tag_unpack()?;
  127. match field_number {
  128. 1 => {
  129. ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.uri)?;
  130. },
  131. 2 => {
  132. if wire_type != ::protobuf::wire_format::WireTypeVarint {
  133. return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
  134. };
  135. let tmp = is.read_int32()?;
  136. self.expiry = ::std::option::Option::Some(tmp);
  137. },
  138. 3 => {
  139. if wire_type != ::protobuf::wire_format::WireTypeVarint {
  140. return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
  141. };
  142. let tmp = is.read_int32()?;
  143. self.status_code = ::std::option::Option::Some(tmp);
  144. },
  145. _ => {
  146. ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
  147. },
  148. };
  149. }
  150. ::std::result::Result::Ok(())
  151. }
  152. // Compute sizes of nested messages
  153. #[allow(unused_variables)]
  154. fn compute_size(&self) -> u32 {
  155. let mut my_size = 0;
  156. if let Some(v) = self.uri.as_ref() {
  157. my_size += ::protobuf::rt::string_size(1, &v);
  158. };
  159. if let Some(v) = self.expiry {
  160. my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint);
  161. };
  162. if let Some(v) = self.status_code {
  163. my_size += ::protobuf::rt::value_size(3, v, ::protobuf::wire_format::WireTypeVarint);
  164. };
  165. my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
  166. self.cached_size.set(my_size);
  167. my_size
  168. }
  169. fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> {
  170. if let Some(v) = self.uri.as_ref() {
  171. os.write_string(1, &v)?;
  172. };
  173. if let Some(v) = self.expiry {
  174. os.write_int32(2, v)?;
  175. };
  176. if let Some(v) = self.status_code {
  177. os.write_int32(3, v)?;
  178. };
  179. os.write_unknown_fields(self.get_unknown_fields())?;
  180. ::std::result::Result::Ok(())
  181. }
  182. fn get_cached_size(&self) -> u32 {
  183. self.cached_size.get()
  184. }
  185. fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
  186. &self.unknown_fields
  187. }
  188. fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
  189. &mut self.unknown_fields
  190. }
  191. fn as_any(&self) -> &::std::any::Any {
  192. self as &::std::any::Any
  193. }
  194. fn as_any_mut(&mut self) -> &mut ::std::any::Any {
  195. self as &mut ::std::any::Any
  196. }
  197. fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> {
  198. self
  199. }
  200. fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
  201. ::protobuf::MessageStatic::descriptor_static(None::<Self>)
  202. }
  203. }
  204. impl ::protobuf::MessageStatic for Subscription {
  205. fn new() -> Subscription {
  206. Subscription::new()
  207. }
  208. fn descriptor_static(_: ::std::option::Option<Subscription>) -> &'static ::protobuf::reflect::MessageDescriptor {
  209. static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy {
  210. lock: ::protobuf::lazy::ONCE_INIT,
  211. ptr: 0 as *const ::protobuf::reflect::MessageDescriptor,
  212. };
  213. unsafe {
  214. descriptor.get(|| {
  215. let mut fields = ::std::vec::Vec::new();
  216. fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
  217. "uri",
  218. Subscription::get_uri_for_reflect,
  219. Subscription::mut_uri_for_reflect,
  220. ));
  221. fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeInt32>(
  222. "expiry",
  223. Subscription::get_expiry_for_reflect,
  224. Subscription::mut_expiry_for_reflect,
  225. ));
  226. fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeInt32>(
  227. "status_code",
  228. Subscription::get_status_code_for_reflect,
  229. Subscription::mut_status_code_for_reflect,
  230. ));
  231. ::protobuf::reflect::MessageDescriptor::new::<Subscription>(
  232. "Subscription",
  233. fields,
  234. file_descriptor_proto()
  235. )
  236. })
  237. }
  238. }
  239. }
  240. impl ::protobuf::Clear for Subscription {
  241. fn clear(&mut self) {
  242. self.clear_uri();
  243. self.clear_expiry();
  244. self.clear_status_code();
  245. self.unknown_fields.clear();
  246. }
  247. }
  248. impl ::std::fmt::Debug for Subscription {
  249. fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
  250. ::protobuf::text_format::fmt(self, f)
  251. }
  252. }
  253. impl ::protobuf::reflect::ProtobufValue for Subscription {
  254. fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
  255. ::protobuf::reflect::ProtobufValueRef::Message(self)
  256. }
  257. }
  258. static file_descriptor_proto_data: &'static [u8] = &[
  259. 0x0a, 0x0c, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x59,
  260. 0x0a, 0x0c, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x10,
  261. 0x0a, 0x03, 0x75, 0x72, 0x69, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x69,
  262. 0x12, 0x16, 0x0a, 0x06, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05,
  263. 0x52, 0x06, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x74,
  264. 0x75, 0x73, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x73,
  265. 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x4a, 0xf9, 0x01, 0x0a, 0x06, 0x12, 0x04,
  266. 0x00, 0x00, 0x06, 0x01, 0x0a, 0x08, 0x0a, 0x01, 0x0c, 0x12, 0x03, 0x00, 0x00, 0x12, 0x0a, 0x0a,
  267. 0x0a, 0x02, 0x04, 0x00, 0x12, 0x04, 0x02, 0x00, 0x06, 0x01, 0x0a, 0x0a, 0x0a, 0x03, 0x04, 0x00,
  268. 0x01, 0x12, 0x03, 0x02, 0x08, 0x14, 0x0a, 0x0b, 0x0a, 0x04, 0x04, 0x00, 0x02, 0x00, 0x12, 0x03,
  269. 0x03, 0x04, 0x1e, 0x0a, 0x0c, 0x0a, 0x05, 0x04, 0x00, 0x02, 0x00, 0x04, 0x12, 0x03, 0x03, 0x04,
  270. 0x0c, 0x0a, 0x0c, 0x0a, 0x05, 0x04, 0x00, 0x02, 0x00, 0x05, 0x12, 0x03, 0x03, 0x0d, 0x13, 0x0a,
  271. 0x0c, 0x0a, 0x05, 0x04, 0x00, 0x02, 0x00, 0x01, 0x12, 0x03, 0x03, 0x14, 0x17, 0x0a, 0x0c, 0x0a,
  272. 0x05, 0x04, 0x00, 0x02, 0x00, 0x03, 0x12, 0x03, 0x03, 0x1a, 0x1d, 0x0a, 0x0b, 0x0a, 0x04, 0x04,
  273. 0x00, 0x02, 0x01, 0x12, 0x03, 0x04, 0x04, 0x20, 0x0a, 0x0c, 0x0a, 0x05, 0x04, 0x00, 0x02, 0x01,
  274. 0x04, 0x12, 0x03, 0x04, 0x04, 0x0c, 0x0a, 0x0c, 0x0a, 0x05, 0x04, 0x00, 0x02, 0x01, 0x05, 0x12,
  275. 0x03, 0x04, 0x0d, 0x12, 0x0a, 0x0c, 0x0a, 0x05, 0x04, 0x00, 0x02, 0x01, 0x01, 0x12, 0x03, 0x04,
  276. 0x13, 0x19, 0x0a, 0x0c, 0x0a, 0x05, 0x04, 0x00, 0x02, 0x01, 0x03, 0x12, 0x03, 0x04, 0x1c, 0x1f,
  277. 0x0a, 0x0b, 0x0a, 0x04, 0x04, 0x00, 0x02, 0x02, 0x12, 0x03, 0x05, 0x04, 0x25, 0x0a, 0x0c, 0x0a,
  278. 0x05, 0x04, 0x00, 0x02, 0x02, 0x04, 0x12, 0x03, 0x05, 0x04, 0x0c, 0x0a, 0x0c, 0x0a, 0x05, 0x04,
  279. 0x00, 0x02, 0x02, 0x05, 0x12, 0x03, 0x05, 0x0d, 0x12, 0x0a, 0x0c, 0x0a, 0x05, 0x04, 0x00, 0x02,
  280. 0x02, 0x01, 0x12, 0x03, 0x05, 0x13, 0x1e, 0x0a, 0x0c, 0x0a, 0x05, 0x04, 0x00, 0x02, 0x02, 0x03,
  281. 0x12, 0x03, 0x05, 0x21, 0x24,
  282. ];
  283. static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy {
  284. lock: ::protobuf::lazy::ONCE_INIT,
  285. ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto,
  286. };
  287. fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
  288. ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
  289. }
  290. pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
  291. unsafe {
  292. file_descriptor_proto_lazy.get(|| {
  293. parse_descriptor_proto()
  294. })
  295. }
  296. }