kv.rs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  1. // This file is generated by rust-protobuf 2.22.1. Do not edit
  2. // @generated
  3. // https://github.com/rust-lang/rust-clippy/issues/702
  4. #![allow(unknown_lints)]
  5. #![allow(clippy::all)]
  6. #![allow(unused_attributes)]
  7. #![cfg_attr(rustfmt, rustfmt::skip)]
  8. #![allow(box_pointers)]
  9. #![allow(dead_code)]
  10. #![allow(missing_docs)]
  11. #![allow(non_camel_case_types)]
  12. #![allow(non_snake_case)]
  13. #![allow(non_upper_case_globals)]
  14. #![allow(trivial_casts)]
  15. #![allow(unused_imports)]
  16. #![allow(unused_results)]
  17. //! Generated file from `kv.proto`
  18. /// Generated files are compatible only with the same version
  19. /// of protobuf runtime.
  20. // const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_22_1;
  21. #[derive(PartialEq,Clone,Default)]
  22. pub struct KeyValue {
  23. // message fields
  24. pub key: ::std::string::String,
  25. // message oneof groups
  26. pub one_of_str_value: ::std::option::Option<KeyValue_oneof_one_of_str_value>,
  27. pub one_of_int_value: ::std::option::Option<KeyValue_oneof_one_of_int_value>,
  28. pub one_of_float_value: ::std::option::Option<KeyValue_oneof_one_of_float_value>,
  29. pub one_of_bool_value: ::std::option::Option<KeyValue_oneof_one_of_bool_value>,
  30. // special fields
  31. pub unknown_fields: ::protobuf::UnknownFields,
  32. pub cached_size: ::protobuf::CachedSize,
  33. }
  34. impl<'a> ::std::default::Default for &'a KeyValue {
  35. fn default() -> &'a KeyValue {
  36. <KeyValue as ::protobuf::Message>::default_instance()
  37. }
  38. }
  39. #[derive(Clone,PartialEq,Debug)]
  40. pub enum KeyValue_oneof_one_of_str_value {
  41. str_value(::std::string::String),
  42. }
  43. #[derive(Clone,PartialEq,Debug)]
  44. pub enum KeyValue_oneof_one_of_int_value {
  45. int_value(i64),
  46. }
  47. #[derive(Clone,PartialEq,Debug)]
  48. pub enum KeyValue_oneof_one_of_float_value {
  49. float_value(f64),
  50. }
  51. #[derive(Clone,PartialEq,Debug)]
  52. pub enum KeyValue_oneof_one_of_bool_value {
  53. bool_value(bool),
  54. }
  55. impl KeyValue {
  56. pub fn new() -> KeyValue {
  57. ::std::default::Default::default()
  58. }
  59. // string key = 1;
  60. pub fn get_key(&self) -> &str {
  61. &self.key
  62. }
  63. pub fn clear_key(&mut self) {
  64. self.key.clear();
  65. }
  66. // Param is passed by value, moved
  67. pub fn set_key(&mut self, v: ::std::string::String) {
  68. self.key = v;
  69. }
  70. // Mutable pointer to the field.
  71. // If field is not initialized, it is initialized with default value first.
  72. pub fn mut_key(&mut self) -> &mut ::std::string::String {
  73. &mut self.key
  74. }
  75. // Take field
  76. pub fn take_key(&mut self) -> ::std::string::String {
  77. ::std::mem::replace(&mut self.key, ::std::string::String::new())
  78. }
  79. // string str_value = 2;
  80. pub fn get_str_value(&self) -> &str {
  81. match self.one_of_str_value {
  82. ::std::option::Option::Some(KeyValue_oneof_one_of_str_value::str_value(ref v)) => v,
  83. _ => "",
  84. }
  85. }
  86. pub fn clear_str_value(&mut self) {
  87. self.one_of_str_value = ::std::option::Option::None;
  88. }
  89. pub fn has_str_value(&self) -> bool {
  90. match self.one_of_str_value {
  91. ::std::option::Option::Some(KeyValue_oneof_one_of_str_value::str_value(..)) => true,
  92. _ => false,
  93. }
  94. }
  95. // Param is passed by value, moved
  96. pub fn set_str_value(&mut self, v: ::std::string::String) {
  97. self.one_of_str_value = ::std::option::Option::Some(KeyValue_oneof_one_of_str_value::str_value(v))
  98. }
  99. // Mutable pointer to the field.
  100. pub fn mut_str_value(&mut self) -> &mut ::std::string::String {
  101. if let ::std::option::Option::Some(KeyValue_oneof_one_of_str_value::str_value(_)) = self.one_of_str_value {
  102. } else {
  103. self.one_of_str_value = ::std::option::Option::Some(KeyValue_oneof_one_of_str_value::str_value(::std::string::String::new()));
  104. }
  105. match self.one_of_str_value {
  106. ::std::option::Option::Some(KeyValue_oneof_one_of_str_value::str_value(ref mut v)) => v,
  107. _ => panic!(),
  108. }
  109. }
  110. // Take field
  111. pub fn take_str_value(&mut self) -> ::std::string::String {
  112. if self.has_str_value() {
  113. match self.one_of_str_value.take() {
  114. ::std::option::Option::Some(KeyValue_oneof_one_of_str_value::str_value(v)) => v,
  115. _ => panic!(),
  116. }
  117. } else {
  118. ::std::string::String::new()
  119. }
  120. }
  121. // int64 int_value = 3;
  122. pub fn get_int_value(&self) -> i64 {
  123. match self.one_of_int_value {
  124. ::std::option::Option::Some(KeyValue_oneof_one_of_int_value::int_value(v)) => v,
  125. _ => 0,
  126. }
  127. }
  128. pub fn clear_int_value(&mut self) {
  129. self.one_of_int_value = ::std::option::Option::None;
  130. }
  131. pub fn has_int_value(&self) -> bool {
  132. match self.one_of_int_value {
  133. ::std::option::Option::Some(KeyValue_oneof_one_of_int_value::int_value(..)) => true,
  134. _ => false,
  135. }
  136. }
  137. // Param is passed by value, moved
  138. pub fn set_int_value(&mut self, v: i64) {
  139. self.one_of_int_value = ::std::option::Option::Some(KeyValue_oneof_one_of_int_value::int_value(v))
  140. }
  141. // double float_value = 4;
  142. pub fn get_float_value(&self) -> f64 {
  143. match self.one_of_float_value {
  144. ::std::option::Option::Some(KeyValue_oneof_one_of_float_value::float_value(v)) => v,
  145. _ => 0.,
  146. }
  147. }
  148. pub fn clear_float_value(&mut self) {
  149. self.one_of_float_value = ::std::option::Option::None;
  150. }
  151. pub fn has_float_value(&self) -> bool {
  152. match self.one_of_float_value {
  153. ::std::option::Option::Some(KeyValue_oneof_one_of_float_value::float_value(..)) => true,
  154. _ => false,
  155. }
  156. }
  157. // Param is passed by value, moved
  158. pub fn set_float_value(&mut self, v: f64) {
  159. self.one_of_float_value = ::std::option::Option::Some(KeyValue_oneof_one_of_float_value::float_value(v))
  160. }
  161. // bool bool_value = 5;
  162. pub fn get_bool_value(&self) -> bool {
  163. match self.one_of_bool_value {
  164. ::std::option::Option::Some(KeyValue_oneof_one_of_bool_value::bool_value(v)) => v,
  165. _ => false,
  166. }
  167. }
  168. pub fn clear_bool_value(&mut self) {
  169. self.one_of_bool_value = ::std::option::Option::None;
  170. }
  171. pub fn has_bool_value(&self) -> bool {
  172. match self.one_of_bool_value {
  173. ::std::option::Option::Some(KeyValue_oneof_one_of_bool_value::bool_value(..)) => true,
  174. _ => false,
  175. }
  176. }
  177. // Param is passed by value, moved
  178. pub fn set_bool_value(&mut self, v: bool) {
  179. self.one_of_bool_value = ::std::option::Option::Some(KeyValue_oneof_one_of_bool_value::bool_value(v))
  180. }
  181. }
  182. impl ::protobuf::Message for KeyValue {
  183. fn is_initialized(&self) -> bool {
  184. true
  185. }
  186. fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
  187. while !is.eof()? {
  188. let (field_number, wire_type) = is.read_tag_unpack()?;
  189. match field_number {
  190. 1 => {
  191. ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.key)?;
  192. },
  193. 2 => {
  194. if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited {
  195. return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
  196. }
  197. self.one_of_str_value = ::std::option::Option::Some(KeyValue_oneof_one_of_str_value::str_value(is.read_string()?));
  198. },
  199. 3 => {
  200. if wire_type != ::protobuf::wire_format::WireTypeVarint {
  201. return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
  202. }
  203. self.one_of_int_value = ::std::option::Option::Some(KeyValue_oneof_one_of_int_value::int_value(is.read_int64()?));
  204. },
  205. 4 => {
  206. if wire_type != ::protobuf::wire_format::WireTypeFixed64 {
  207. return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
  208. }
  209. self.one_of_float_value = ::std::option::Option::Some(KeyValue_oneof_one_of_float_value::float_value(is.read_double()?));
  210. },
  211. 5 => {
  212. if wire_type != ::protobuf::wire_format::WireTypeVarint {
  213. return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
  214. }
  215. self.one_of_bool_value = ::std::option::Option::Some(KeyValue_oneof_one_of_bool_value::bool_value(is.read_bool()?));
  216. },
  217. _ => {
  218. ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
  219. },
  220. };
  221. }
  222. ::std::result::Result::Ok(())
  223. }
  224. // Compute sizes of nested messages
  225. #[allow(unused_variables)]
  226. fn compute_size(&self) -> u32 {
  227. let mut my_size = 0;
  228. if !self.key.is_empty() {
  229. my_size += ::protobuf::rt::string_size(1, &self.key);
  230. }
  231. if let ::std::option::Option::Some(ref v) = self.one_of_str_value {
  232. match v {
  233. &KeyValue_oneof_one_of_str_value::str_value(ref v) => {
  234. my_size += ::protobuf::rt::string_size(2, &v);
  235. },
  236. };
  237. }
  238. if let ::std::option::Option::Some(ref v) = self.one_of_int_value {
  239. match v {
  240. &KeyValue_oneof_one_of_int_value::int_value(v) => {
  241. my_size += ::protobuf::rt::value_size(3, v, ::protobuf::wire_format::WireTypeVarint);
  242. },
  243. };
  244. }
  245. if let ::std::option::Option::Some(ref v) = self.one_of_float_value {
  246. match v {
  247. &KeyValue_oneof_one_of_float_value::float_value(v) => {
  248. my_size += 9;
  249. },
  250. };
  251. }
  252. if let ::std::option::Option::Some(ref v) = self.one_of_bool_value {
  253. match v {
  254. &KeyValue_oneof_one_of_bool_value::bool_value(v) => {
  255. my_size += 2;
  256. },
  257. };
  258. }
  259. my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
  260. self.cached_size.set(my_size);
  261. my_size
  262. }
  263. fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
  264. if !self.key.is_empty() {
  265. os.write_string(1, &self.key)?;
  266. }
  267. if let ::std::option::Option::Some(ref v) = self.one_of_str_value {
  268. match v {
  269. &KeyValue_oneof_one_of_str_value::str_value(ref v) => {
  270. os.write_string(2, v)?;
  271. },
  272. };
  273. }
  274. if let ::std::option::Option::Some(ref v) = self.one_of_int_value {
  275. match v {
  276. &KeyValue_oneof_one_of_int_value::int_value(v) => {
  277. os.write_int64(3, v)?;
  278. },
  279. };
  280. }
  281. if let ::std::option::Option::Some(ref v) = self.one_of_float_value {
  282. match v {
  283. &KeyValue_oneof_one_of_float_value::float_value(v) => {
  284. os.write_double(4, v)?;
  285. },
  286. };
  287. }
  288. if let ::std::option::Option::Some(ref v) = self.one_of_bool_value {
  289. match v {
  290. &KeyValue_oneof_one_of_bool_value::bool_value(v) => {
  291. os.write_bool(5, v)?;
  292. },
  293. };
  294. }
  295. os.write_unknown_fields(self.get_unknown_fields())?;
  296. ::std::result::Result::Ok(())
  297. }
  298. fn get_cached_size(&self) -> u32 {
  299. self.cached_size.get()
  300. }
  301. fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
  302. &self.unknown_fields
  303. }
  304. fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
  305. &mut self.unknown_fields
  306. }
  307. fn as_any(&self) -> &dyn (::std::any::Any) {
  308. self as &dyn (::std::any::Any)
  309. }
  310. fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
  311. self as &mut dyn (::std::any::Any)
  312. }
  313. fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
  314. self
  315. }
  316. fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
  317. Self::descriptor_static()
  318. }
  319. fn new() -> KeyValue {
  320. KeyValue::new()
  321. }
  322. fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
  323. static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT;
  324. descriptor.get(|| {
  325. let mut fields = ::std::vec::Vec::new();
  326. fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
  327. "key",
  328. |m: &KeyValue| { &m.key },
  329. |m: &mut KeyValue| { &mut m.key },
  330. ));
  331. fields.push(::protobuf::reflect::accessor::make_singular_string_accessor::<_>(
  332. "str_value",
  333. KeyValue::has_str_value,
  334. KeyValue::get_str_value,
  335. ));
  336. fields.push(::protobuf::reflect::accessor::make_singular_i64_accessor::<_>(
  337. "int_value",
  338. KeyValue::has_int_value,
  339. KeyValue::get_int_value,
  340. ));
  341. fields.push(::protobuf::reflect::accessor::make_singular_f64_accessor::<_>(
  342. "float_value",
  343. KeyValue::has_float_value,
  344. KeyValue::get_float_value,
  345. ));
  346. fields.push(::protobuf::reflect::accessor::make_singular_bool_accessor::<_>(
  347. "bool_value",
  348. KeyValue::has_bool_value,
  349. KeyValue::get_bool_value,
  350. ));
  351. ::protobuf::reflect::MessageDescriptor::new_pb_name::<KeyValue>(
  352. "KeyValue",
  353. fields,
  354. file_descriptor_proto()
  355. )
  356. })
  357. }
  358. fn default_instance() -> &'static KeyValue {
  359. static instance: ::protobuf::rt::LazyV2<KeyValue> = ::protobuf::rt::LazyV2::INIT;
  360. instance.get(KeyValue::new)
  361. }
  362. }
  363. impl ::protobuf::Clear for KeyValue {
  364. fn clear(&mut self) {
  365. self.key.clear();
  366. self.one_of_str_value = ::std::option::Option::None;
  367. self.one_of_int_value = ::std::option::Option::None;
  368. self.one_of_float_value = ::std::option::Option::None;
  369. self.one_of_bool_value = ::std::option::Option::None;
  370. self.unknown_fields.clear();
  371. }
  372. }
  373. impl ::std::fmt::Debug for KeyValue {
  374. fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
  375. ::protobuf::text_format::fmt(self, f)
  376. }
  377. }
  378. impl ::protobuf::reflect::ProtobufValue for KeyValue {
  379. fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
  380. ::protobuf::reflect::ReflectValueRef::Message(self)
  381. }
  382. }
  383. static file_descriptor_proto_data: &'static [u8] = b"\
  384. \n\x08kv.proto\"\xf1\x01\n\x08KeyValue\x12\x10\n\x03key\x18\x01\x20\x01(\
  385. \tR\x03key\x12\x1d\n\tstr_value\x18\x02\x20\x01(\tH\0R\x08strValue\x12\
  386. \x1d\n\tint_value\x18\x03\x20\x01(\x03H\x01R\x08intValue\x12!\n\x0bfloat\
  387. _value\x18\x04\x20\x01(\x01H\x02R\nfloatValue\x12\x1f\n\nbool_value\x18\
  388. \x05\x20\x01(\x08H\x03R\tboolValueB\x12\n\x10one_of_str_valueB\x12\n\x10\
  389. one_of_int_valueB\x14\n\x12one_of_float_valueB\x13\n\x11one_of_bool_valu\
  390. eJ\xa9\x03\n\x06\x12\x04\0\0\x08\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\n\
  391. \n\x02\x04\0\x12\x04\x02\0\x08\x01\n\n\n\x03\x04\0\x01\x12\x03\x02\x08\
  392. \x10\n\x0b\n\x04\x04\0\x02\0\x12\x03\x03\x04\x13\n\x0c\n\x05\x04\0\x02\0\
  393. \x05\x12\x03\x03\x04\n\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x03\x0b\x0e\n\
  394. \x0c\n\x05\x04\0\x02\0\x03\x12\x03\x03\x11\x12\n\x0b\n\x04\x04\0\x08\0\
  395. \x12\x03\x04\x044\n\x0c\n\x05\x04\0\x08\0\x01\x12\x03\x04\n\x1a\n\x0b\n\
  396. \x04\x04\0\x02\x01\x12\x03\x04\x1d2\n\x0c\n\x05\x04\0\x02\x01\x05\x12\
  397. \x03\x04\x1d#\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x04$-\n\x0c\n\x05\
  398. \x04\0\x02\x01\x03\x12\x03\x0401\n\x0b\n\x04\x04\0\x08\x01\x12\x03\x05\
  399. \x043\n\x0c\n\x05\x04\0\x08\x01\x01\x12\x03\x05\n\x1a\n\x0b\n\x04\x04\0\
  400. \x02\x02\x12\x03\x05\x1d1\n\x0c\n\x05\x04\0\x02\x02\x05\x12\x03\x05\x1d\
  401. \"\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03\x05#,\n\x0c\n\x05\x04\0\x02\x02\
  402. \x03\x12\x03\x05/0\n\x0b\n\x04\x04\0\x08\x02\x12\x03\x06\x048\n\x0c\n\
  403. \x05\x04\0\x08\x02\x01\x12\x03\x06\n\x1c\n\x0b\n\x04\x04\0\x02\x03\x12\
  404. \x03\x06\x1f6\n\x0c\n\x05\x04\0\x02\x03\x05\x12\x03\x06\x1f%\n\x0c\n\x05\
  405. \x04\0\x02\x03\x01\x12\x03\x06&1\n\x0c\n\x05\x04\0\x02\x03\x03\x12\x03\
  406. \x0645\n\x0b\n\x04\x04\0\x08\x03\x12\x03\x07\x044\n\x0c\n\x05\x04\0\x08\
  407. \x03\x01\x12\x03\x07\n\x1b\n\x0b\n\x04\x04\0\x02\x04\x12\x03\x07\x1e2\n\
  408. \x0c\n\x05\x04\0\x02\x04\x05\x12\x03\x07\x1e\"\n\x0c\n\x05\x04\0\x02\x04\
  409. \x01\x12\x03\x07#-\n\x0c\n\x05\x04\0\x02\x04\x03\x12\x03\x0701b\x06proto\
  410. 3\
  411. ";
  412. static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;
  413. fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
  414. ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap()
  415. }
  416. pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
  417. file_descriptor_proto_lazy.get(|| {
  418. parse_descriptor_proto()
  419. })
  420. }