pubsub.rs 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. // This file is generated by rust-protobuf 2.14.0. Do not edit
  2. // @generated
  3. // https://github.com/rust-lang/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_14_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
  70. .take()
  71. .unwrap_or_else(|| ::std::string::String::new())
  72. }
  73. // optional int32 expiry = 2;
  74. pub fn get_expiry(&self) -> i32 {
  75. self.expiry.unwrap_or(0)
  76. }
  77. pub fn clear_expiry(&mut self) {
  78. self.expiry = ::std::option::Option::None;
  79. }
  80. pub fn has_expiry(&self) -> bool {
  81. self.expiry.is_some()
  82. }
  83. // Param is passed by value, moved
  84. pub fn set_expiry(&mut self, v: i32) {
  85. self.expiry = ::std::option::Option::Some(v);
  86. }
  87. // optional int32 status_code = 3;
  88. pub fn get_status_code(&self) -> i32 {
  89. self.status_code.unwrap_or(0)
  90. }
  91. pub fn clear_status_code(&mut self) {
  92. self.status_code = ::std::option::Option::None;
  93. }
  94. pub fn has_status_code(&self) -> bool {
  95. self.status_code.is_some()
  96. }
  97. // Param is passed by value, moved
  98. pub fn set_status_code(&mut self, v: i32) {
  99. self.status_code = ::std::option::Option::Some(v);
  100. }
  101. }
  102. impl ::protobuf::Message for Subscription {
  103. fn is_initialized(&self) -> bool {
  104. true
  105. }
  106. fn merge_from(
  107. &mut self,
  108. is: &mut ::protobuf::CodedInputStream<'_>,
  109. ) -> ::protobuf::ProtobufResult<()> {
  110. while !is.eof()? {
  111. let (field_number, wire_type) = is.read_tag_unpack()?;
  112. match field_number {
  113. 1 => {
  114. ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.uri)?;
  115. }
  116. 2 => {
  117. if wire_type != ::protobuf::wire_format::WireTypeVarint {
  118. return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(
  119. wire_type,
  120. ));
  121. }
  122. let tmp = is.read_int32()?;
  123. self.expiry = ::std::option::Option::Some(tmp);
  124. }
  125. 3 => {
  126. if wire_type != ::protobuf::wire_format::WireTypeVarint {
  127. return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(
  128. wire_type,
  129. ));
  130. }
  131. let tmp = is.read_int32()?;
  132. self.status_code = ::std::option::Option::Some(tmp);
  133. }
  134. _ => {
  135. ::protobuf::rt::read_unknown_or_skip_group(
  136. field_number,
  137. wire_type,
  138. is,
  139. self.mut_unknown_fields(),
  140. )?;
  141. }
  142. };
  143. }
  144. ::std::result::Result::Ok(())
  145. }
  146. // Compute sizes of nested messages
  147. #[allow(unused_variables)]
  148. fn compute_size(&self) -> u32 {
  149. let mut my_size = 0;
  150. if let Some(ref v) = self.uri.as_ref() {
  151. my_size += ::protobuf::rt::string_size(1, &v);
  152. }
  153. if let Some(v) = self.expiry {
  154. my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint);
  155. }
  156. if let Some(v) = self.status_code {
  157. my_size += ::protobuf::rt::value_size(3, v, ::protobuf::wire_format::WireTypeVarint);
  158. }
  159. my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
  160. self.cached_size.set(my_size);
  161. my_size
  162. }
  163. fn write_to_with_cached_sizes(
  164. &self,
  165. os: &mut ::protobuf::CodedOutputStream<'_>,
  166. ) -> ::protobuf::ProtobufResult<()> {
  167. if let Some(ref v) = self.uri.as_ref() {
  168. os.write_string(1, &v)?;
  169. }
  170. if let Some(v) = self.expiry {
  171. os.write_int32(2, v)?;
  172. }
  173. if let Some(v) = self.status_code {
  174. os.write_int32(3, v)?;
  175. }
  176. os.write_unknown_fields(self.get_unknown_fields())?;
  177. ::std::result::Result::Ok(())
  178. }
  179. fn get_cached_size(&self) -> u32 {
  180. self.cached_size.get()
  181. }
  182. fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
  183. &self.unknown_fields
  184. }
  185. fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
  186. &mut self.unknown_fields
  187. }
  188. fn as_any(&self) -> &dyn (::std::any::Any) {
  189. self as &dyn (::std::any::Any)
  190. }
  191. fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
  192. self as &mut dyn (::std::any::Any)
  193. }
  194. fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
  195. self
  196. }
  197. fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
  198. Self::descriptor_static()
  199. }
  200. fn new() -> Subscription {
  201. Subscription::new()
  202. }
  203. fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
  204. static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> =
  205. ::protobuf::lazy::Lazy::INIT;
  206. unsafe {
  207. descriptor.get(|| {
  208. let mut fields = ::std::vec::Vec::new();
  209. fields.push(
  210. ::protobuf::reflect::accessor::make_singular_field_accessor::<
  211. _,
  212. ::protobuf::types::ProtobufTypeString,
  213. >(
  214. "uri",
  215. |m: &Subscription| &m.uri,
  216. |m: &mut Subscription| &mut m.uri,
  217. ),
  218. );
  219. fields.push(::protobuf::reflect::accessor::make_option_accessor::<
  220. _,
  221. ::protobuf::types::ProtobufTypeInt32,
  222. >(
  223. "expiry",
  224. |m: &Subscription| &m.expiry,
  225. |m: &mut Subscription| &mut m.expiry,
  226. ));
  227. fields.push(::protobuf::reflect::accessor::make_option_accessor::<
  228. _,
  229. ::protobuf::types::ProtobufTypeInt32,
  230. >(
  231. "status_code",
  232. |m: &Subscription| &m.status_code,
  233. |m: &mut Subscription| &mut m.status_code,
  234. ));
  235. ::protobuf::reflect::MessageDescriptor::new_pb_name::<Subscription>(
  236. "Subscription",
  237. fields,
  238. file_descriptor_proto(),
  239. )
  240. })
  241. }
  242. }
  243. fn default_instance() -> &'static Subscription {
  244. static mut instance: ::protobuf::lazy::Lazy<Subscription> = ::protobuf::lazy::Lazy::INIT;
  245. unsafe { instance.get(Subscription::new) }
  246. }
  247. }
  248. impl ::protobuf::Clear for Subscription {
  249. fn clear(&mut self) {
  250. self.uri.clear();
  251. self.expiry = ::std::option::Option::None;
  252. self.status_code = ::std::option::Option::None;
  253. self.unknown_fields.clear();
  254. }
  255. }
  256. impl ::std::fmt::Debug for Subscription {
  257. fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
  258. ::protobuf::text_format::fmt(self, f)
  259. }
  260. }
  261. impl ::protobuf::reflect::ProtobufValue for Subscription {
  262. fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
  263. ::protobuf::reflect::ReflectValueRef::Message(self)
  264. }
  265. }
  266. static file_descriptor_proto_data: &'static [u8] = b"\
  267. \n\x0cpubsub.proto\x12\0\"H\n\x0cSubscription\x12\r\n\x03uri\x18\x01\x20\
  268. \x01(\tB\0\x12\x10\n\x06expiry\x18\x02\x20\x01(\x05B\0\x12\x15\n\x0bstat\
  269. us_code\x18\x03\x20\x01(\x05B\0:\0B\0b\x06proto2\
  270. ";
  271. static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<
  272. ::protobuf::descriptor::FileDescriptorProto,
  273. > = ::protobuf::lazy::Lazy::INIT;
  274. fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
  275. ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
  276. }
  277. pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
  278. unsafe { file_descriptor_proto_lazy.get(|| parse_descriptor_proto()) }
  279. }