pubsub.rs 9.3 KB

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