message.rs 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931
  1. // This file is generated by rust-protobuf 2.10.2. 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 `message.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_10_2;
  23. #[derive(PartialEq,Clone,Default)]
  24. pub struct RegisterPeer {
  25. // message fields
  26. pub hbb_addr: ::std::string::String,
  27. // special fields
  28. pub unknown_fields: ::protobuf::UnknownFields,
  29. pub cached_size: ::protobuf::CachedSize,
  30. }
  31. impl<'a> ::std::default::Default for &'a RegisterPeer {
  32. fn default() -> &'a RegisterPeer {
  33. <RegisterPeer as ::protobuf::Message>::default_instance()
  34. }
  35. }
  36. impl RegisterPeer {
  37. pub fn new() -> RegisterPeer {
  38. ::std::default::Default::default()
  39. }
  40. // string hbb_addr = 1;
  41. pub fn get_hbb_addr(&self) -> &str {
  42. &self.hbb_addr
  43. }
  44. pub fn clear_hbb_addr(&mut self) {
  45. self.hbb_addr.clear();
  46. }
  47. // Param is passed by value, moved
  48. pub fn set_hbb_addr(&mut self, v: ::std::string::String) {
  49. self.hbb_addr = v;
  50. }
  51. // Mutable pointer to the field.
  52. // If field is not initialized, it is initialized with default value first.
  53. pub fn mut_hbb_addr(&mut self) -> &mut ::std::string::String {
  54. &mut self.hbb_addr
  55. }
  56. // Take field
  57. pub fn take_hbb_addr(&mut self) -> ::std::string::String {
  58. ::std::mem::replace(&mut self.hbb_addr, ::std::string::String::new())
  59. }
  60. }
  61. impl ::protobuf::Message for RegisterPeer {
  62. fn is_initialized(&self) -> bool {
  63. true
  64. }
  65. fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
  66. while !is.eof()? {
  67. let (field_number, wire_type) = is.read_tag_unpack()?;
  68. match field_number {
  69. 1 => {
  70. ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.hbb_addr)?;
  71. },
  72. _ => {
  73. ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
  74. },
  75. };
  76. }
  77. ::std::result::Result::Ok(())
  78. }
  79. // Compute sizes of nested messages
  80. #[allow(unused_variables)]
  81. fn compute_size(&self) -> u32 {
  82. let mut my_size = 0;
  83. if !self.hbb_addr.is_empty() {
  84. my_size += ::protobuf::rt::string_size(1, &self.hbb_addr);
  85. }
  86. my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
  87. self.cached_size.set(my_size);
  88. my_size
  89. }
  90. fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
  91. if !self.hbb_addr.is_empty() {
  92. os.write_string(1, &self.hbb_addr)?;
  93. }
  94. os.write_unknown_fields(self.get_unknown_fields())?;
  95. ::std::result::Result::Ok(())
  96. }
  97. fn get_cached_size(&self) -> u32 {
  98. self.cached_size.get()
  99. }
  100. fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
  101. &self.unknown_fields
  102. }
  103. fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
  104. &mut self.unknown_fields
  105. }
  106. fn as_any(&self) -> &dyn (::std::any::Any) {
  107. self as &dyn (::std::any::Any)
  108. }
  109. fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
  110. self as &mut dyn (::std::any::Any)
  111. }
  112. fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
  113. self
  114. }
  115. fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
  116. Self::descriptor_static()
  117. }
  118. fn new() -> RegisterPeer {
  119. RegisterPeer::new()
  120. }
  121. fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
  122. static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy {
  123. lock: ::protobuf::lazy::ONCE_INIT,
  124. ptr: 0 as *const ::protobuf::reflect::MessageDescriptor,
  125. };
  126. unsafe {
  127. descriptor.get(|| {
  128. let mut fields = ::std::vec::Vec::new();
  129. fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
  130. "hbb_addr",
  131. |m: &RegisterPeer| { &m.hbb_addr },
  132. |m: &mut RegisterPeer| { &mut m.hbb_addr },
  133. ));
  134. ::protobuf::reflect::MessageDescriptor::new::<RegisterPeer>(
  135. "RegisterPeer",
  136. fields,
  137. file_descriptor_proto()
  138. )
  139. })
  140. }
  141. }
  142. fn default_instance() -> &'static RegisterPeer {
  143. static mut instance: ::protobuf::lazy::Lazy<RegisterPeer> = ::protobuf::lazy::Lazy {
  144. lock: ::protobuf::lazy::ONCE_INIT,
  145. ptr: 0 as *const RegisterPeer,
  146. };
  147. unsafe {
  148. instance.get(RegisterPeer::new)
  149. }
  150. }
  151. }
  152. impl ::protobuf::Clear for RegisterPeer {
  153. fn clear(&mut self) {
  154. self.hbb_addr.clear();
  155. self.unknown_fields.clear();
  156. }
  157. }
  158. impl ::std::fmt::Debug for RegisterPeer {
  159. fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
  160. ::protobuf::text_format::fmt(self, f)
  161. }
  162. }
  163. impl ::protobuf::reflect::ProtobufValue for RegisterPeer {
  164. fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
  165. ::protobuf::reflect::ProtobufValueRef::Message(self)
  166. }
  167. }
  168. #[derive(PartialEq,Clone,Default)]
  169. pub struct PeekPeer {
  170. // message fields
  171. pub hbb_addr: ::std::string::String,
  172. // special fields
  173. pub unknown_fields: ::protobuf::UnknownFields,
  174. pub cached_size: ::protobuf::CachedSize,
  175. }
  176. impl<'a> ::std::default::Default for &'a PeekPeer {
  177. fn default() -> &'a PeekPeer {
  178. <PeekPeer as ::protobuf::Message>::default_instance()
  179. }
  180. }
  181. impl PeekPeer {
  182. pub fn new() -> PeekPeer {
  183. ::std::default::Default::default()
  184. }
  185. // string hbb_addr = 1;
  186. pub fn get_hbb_addr(&self) -> &str {
  187. &self.hbb_addr
  188. }
  189. pub fn clear_hbb_addr(&mut self) {
  190. self.hbb_addr.clear();
  191. }
  192. // Param is passed by value, moved
  193. pub fn set_hbb_addr(&mut self, v: ::std::string::String) {
  194. self.hbb_addr = v;
  195. }
  196. // Mutable pointer to the field.
  197. // If field is not initialized, it is initialized with default value first.
  198. pub fn mut_hbb_addr(&mut self) -> &mut ::std::string::String {
  199. &mut self.hbb_addr
  200. }
  201. // Take field
  202. pub fn take_hbb_addr(&mut self) -> ::std::string::String {
  203. ::std::mem::replace(&mut self.hbb_addr, ::std::string::String::new())
  204. }
  205. }
  206. impl ::protobuf::Message for PeekPeer {
  207. fn is_initialized(&self) -> bool {
  208. true
  209. }
  210. fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
  211. while !is.eof()? {
  212. let (field_number, wire_type) = is.read_tag_unpack()?;
  213. match field_number {
  214. 1 => {
  215. ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.hbb_addr)?;
  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.hbb_addr.is_empty() {
  229. my_size += ::protobuf::rt::string_size(1, &self.hbb_addr);
  230. }
  231. my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
  232. self.cached_size.set(my_size);
  233. my_size
  234. }
  235. fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
  236. if !self.hbb_addr.is_empty() {
  237. os.write_string(1, &self.hbb_addr)?;
  238. }
  239. os.write_unknown_fields(self.get_unknown_fields())?;
  240. ::std::result::Result::Ok(())
  241. }
  242. fn get_cached_size(&self) -> u32 {
  243. self.cached_size.get()
  244. }
  245. fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
  246. &self.unknown_fields
  247. }
  248. fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
  249. &mut self.unknown_fields
  250. }
  251. fn as_any(&self) -> &dyn (::std::any::Any) {
  252. self as &dyn (::std::any::Any)
  253. }
  254. fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
  255. self as &mut dyn (::std::any::Any)
  256. }
  257. fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
  258. self
  259. }
  260. fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
  261. Self::descriptor_static()
  262. }
  263. fn new() -> PeekPeer {
  264. PeekPeer::new()
  265. }
  266. fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
  267. static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy {
  268. lock: ::protobuf::lazy::ONCE_INIT,
  269. ptr: 0 as *const ::protobuf::reflect::MessageDescriptor,
  270. };
  271. unsafe {
  272. descriptor.get(|| {
  273. let mut fields = ::std::vec::Vec::new();
  274. fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
  275. "hbb_addr",
  276. |m: &PeekPeer| { &m.hbb_addr },
  277. |m: &mut PeekPeer| { &mut m.hbb_addr },
  278. ));
  279. ::protobuf::reflect::MessageDescriptor::new::<PeekPeer>(
  280. "PeekPeer",
  281. fields,
  282. file_descriptor_proto()
  283. )
  284. })
  285. }
  286. }
  287. fn default_instance() -> &'static PeekPeer {
  288. static mut instance: ::protobuf::lazy::Lazy<PeekPeer> = ::protobuf::lazy::Lazy {
  289. lock: ::protobuf::lazy::ONCE_INIT,
  290. ptr: 0 as *const PeekPeer,
  291. };
  292. unsafe {
  293. instance.get(PeekPeer::new)
  294. }
  295. }
  296. }
  297. impl ::protobuf::Clear for PeekPeer {
  298. fn clear(&mut self) {
  299. self.hbb_addr.clear();
  300. self.unknown_fields.clear();
  301. }
  302. }
  303. impl ::std::fmt::Debug for PeekPeer {
  304. fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
  305. ::protobuf::text_format::fmt(self, f)
  306. }
  307. }
  308. impl ::protobuf::reflect::ProtobufValue for PeekPeer {
  309. fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
  310. ::protobuf::reflect::ProtobufValueRef::Message(self)
  311. }
  312. }
  313. #[derive(PartialEq,Clone,Default)]
  314. pub struct PeekPeerResponse {
  315. // message fields
  316. pub socket_addr: ::std::vec::Vec<u8>,
  317. // special fields
  318. pub unknown_fields: ::protobuf::UnknownFields,
  319. pub cached_size: ::protobuf::CachedSize,
  320. }
  321. impl<'a> ::std::default::Default for &'a PeekPeerResponse {
  322. fn default() -> &'a PeekPeerResponse {
  323. <PeekPeerResponse as ::protobuf::Message>::default_instance()
  324. }
  325. }
  326. impl PeekPeerResponse {
  327. pub fn new() -> PeekPeerResponse {
  328. ::std::default::Default::default()
  329. }
  330. // bytes socket_addr = 1;
  331. pub fn get_socket_addr(&self) -> &[u8] {
  332. &self.socket_addr
  333. }
  334. pub fn clear_socket_addr(&mut self) {
  335. self.socket_addr.clear();
  336. }
  337. // Param is passed by value, moved
  338. pub fn set_socket_addr(&mut self, v: ::std::vec::Vec<u8>) {
  339. self.socket_addr = v;
  340. }
  341. // Mutable pointer to the field.
  342. // If field is not initialized, it is initialized with default value first.
  343. pub fn mut_socket_addr(&mut self) -> &mut ::std::vec::Vec<u8> {
  344. &mut self.socket_addr
  345. }
  346. // Take field
  347. pub fn take_socket_addr(&mut self) -> ::std::vec::Vec<u8> {
  348. ::std::mem::replace(&mut self.socket_addr, ::std::vec::Vec::new())
  349. }
  350. }
  351. impl ::protobuf::Message for PeekPeerResponse {
  352. fn is_initialized(&self) -> bool {
  353. true
  354. }
  355. fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
  356. while !is.eof()? {
  357. let (field_number, wire_type) = is.read_tag_unpack()?;
  358. match field_number {
  359. 1 => {
  360. ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.socket_addr)?;
  361. },
  362. _ => {
  363. ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
  364. },
  365. };
  366. }
  367. ::std::result::Result::Ok(())
  368. }
  369. // Compute sizes of nested messages
  370. #[allow(unused_variables)]
  371. fn compute_size(&self) -> u32 {
  372. let mut my_size = 0;
  373. if !self.socket_addr.is_empty() {
  374. my_size += ::protobuf::rt::bytes_size(1, &self.socket_addr);
  375. }
  376. my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
  377. self.cached_size.set(my_size);
  378. my_size
  379. }
  380. fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
  381. if !self.socket_addr.is_empty() {
  382. os.write_bytes(1, &self.socket_addr)?;
  383. }
  384. os.write_unknown_fields(self.get_unknown_fields())?;
  385. ::std::result::Result::Ok(())
  386. }
  387. fn get_cached_size(&self) -> u32 {
  388. self.cached_size.get()
  389. }
  390. fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
  391. &self.unknown_fields
  392. }
  393. fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
  394. &mut self.unknown_fields
  395. }
  396. fn as_any(&self) -> &dyn (::std::any::Any) {
  397. self as &dyn (::std::any::Any)
  398. }
  399. fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
  400. self as &mut dyn (::std::any::Any)
  401. }
  402. fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
  403. self
  404. }
  405. fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
  406. Self::descriptor_static()
  407. }
  408. fn new() -> PeekPeerResponse {
  409. PeekPeerResponse::new()
  410. }
  411. fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
  412. static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy {
  413. lock: ::protobuf::lazy::ONCE_INIT,
  414. ptr: 0 as *const ::protobuf::reflect::MessageDescriptor,
  415. };
  416. unsafe {
  417. descriptor.get(|| {
  418. let mut fields = ::std::vec::Vec::new();
  419. fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>(
  420. "socket_addr",
  421. |m: &PeekPeerResponse| { &m.socket_addr },
  422. |m: &mut PeekPeerResponse| { &mut m.socket_addr },
  423. ));
  424. ::protobuf::reflect::MessageDescriptor::new::<PeekPeerResponse>(
  425. "PeekPeerResponse",
  426. fields,
  427. file_descriptor_proto()
  428. )
  429. })
  430. }
  431. }
  432. fn default_instance() -> &'static PeekPeerResponse {
  433. static mut instance: ::protobuf::lazy::Lazy<PeekPeerResponse> = ::protobuf::lazy::Lazy {
  434. lock: ::protobuf::lazy::ONCE_INIT,
  435. ptr: 0 as *const PeekPeerResponse,
  436. };
  437. unsafe {
  438. instance.get(PeekPeerResponse::new)
  439. }
  440. }
  441. }
  442. impl ::protobuf::Clear for PeekPeerResponse {
  443. fn clear(&mut self) {
  444. self.socket_addr.clear();
  445. self.unknown_fields.clear();
  446. }
  447. }
  448. impl ::std::fmt::Debug for PeekPeerResponse {
  449. fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
  450. ::protobuf::text_format::fmt(self, f)
  451. }
  452. }
  453. impl ::protobuf::reflect::ProtobufValue for PeekPeerResponse {
  454. fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
  455. ::protobuf::reflect::ProtobufValueRef::Message(self)
  456. }
  457. }
  458. #[derive(PartialEq,Clone,Default)]
  459. pub struct Message {
  460. // message oneof groups
  461. pub union: ::std::option::Option<Message_oneof_union>,
  462. // special fields
  463. pub unknown_fields: ::protobuf::UnknownFields,
  464. pub cached_size: ::protobuf::CachedSize,
  465. }
  466. impl<'a> ::std::default::Default for &'a Message {
  467. fn default() -> &'a Message {
  468. <Message as ::protobuf::Message>::default_instance()
  469. }
  470. }
  471. #[derive(Clone,PartialEq,Debug)]
  472. pub enum Message_oneof_union {
  473. register_peer(RegisterPeer),
  474. peek_peer(PeekPeer),
  475. peek_peer_response(PeekPeerResponse),
  476. }
  477. impl Message {
  478. pub fn new() -> Message {
  479. ::std::default::Default::default()
  480. }
  481. // .hbb.RegisterPeer register_peer = 6;
  482. pub fn get_register_peer(&self) -> &RegisterPeer {
  483. match self.union {
  484. ::std::option::Option::Some(Message_oneof_union::register_peer(ref v)) => v,
  485. _ => RegisterPeer::default_instance(),
  486. }
  487. }
  488. pub fn clear_register_peer(&mut self) {
  489. self.union = ::std::option::Option::None;
  490. }
  491. pub fn has_register_peer(&self) -> bool {
  492. match self.union {
  493. ::std::option::Option::Some(Message_oneof_union::register_peer(..)) => true,
  494. _ => false,
  495. }
  496. }
  497. // Param is passed by value, moved
  498. pub fn set_register_peer(&mut self, v: RegisterPeer) {
  499. self.union = ::std::option::Option::Some(Message_oneof_union::register_peer(v))
  500. }
  501. // Mutable pointer to the field.
  502. pub fn mut_register_peer(&mut self) -> &mut RegisterPeer {
  503. if let ::std::option::Option::Some(Message_oneof_union::register_peer(_)) = self.union {
  504. } else {
  505. self.union = ::std::option::Option::Some(Message_oneof_union::register_peer(RegisterPeer::new()));
  506. }
  507. match self.union {
  508. ::std::option::Option::Some(Message_oneof_union::register_peer(ref mut v)) => v,
  509. _ => panic!(),
  510. }
  511. }
  512. // Take field
  513. pub fn take_register_peer(&mut self) -> RegisterPeer {
  514. if self.has_register_peer() {
  515. match self.union.take() {
  516. ::std::option::Option::Some(Message_oneof_union::register_peer(v)) => v,
  517. _ => panic!(),
  518. }
  519. } else {
  520. RegisterPeer::new()
  521. }
  522. }
  523. // .hbb.PeekPeer peek_peer = 7;
  524. pub fn get_peek_peer(&self) -> &PeekPeer {
  525. match self.union {
  526. ::std::option::Option::Some(Message_oneof_union::peek_peer(ref v)) => v,
  527. _ => PeekPeer::default_instance(),
  528. }
  529. }
  530. pub fn clear_peek_peer(&mut self) {
  531. self.union = ::std::option::Option::None;
  532. }
  533. pub fn has_peek_peer(&self) -> bool {
  534. match self.union {
  535. ::std::option::Option::Some(Message_oneof_union::peek_peer(..)) => true,
  536. _ => false,
  537. }
  538. }
  539. // Param is passed by value, moved
  540. pub fn set_peek_peer(&mut self, v: PeekPeer) {
  541. self.union = ::std::option::Option::Some(Message_oneof_union::peek_peer(v))
  542. }
  543. // Mutable pointer to the field.
  544. pub fn mut_peek_peer(&mut self) -> &mut PeekPeer {
  545. if let ::std::option::Option::Some(Message_oneof_union::peek_peer(_)) = self.union {
  546. } else {
  547. self.union = ::std::option::Option::Some(Message_oneof_union::peek_peer(PeekPeer::new()));
  548. }
  549. match self.union {
  550. ::std::option::Option::Some(Message_oneof_union::peek_peer(ref mut v)) => v,
  551. _ => panic!(),
  552. }
  553. }
  554. // Take field
  555. pub fn take_peek_peer(&mut self) -> PeekPeer {
  556. if self.has_peek_peer() {
  557. match self.union.take() {
  558. ::std::option::Option::Some(Message_oneof_union::peek_peer(v)) => v,
  559. _ => panic!(),
  560. }
  561. } else {
  562. PeekPeer::new()
  563. }
  564. }
  565. // .hbb.PeekPeerResponse peek_peer_response = 8;
  566. pub fn get_peek_peer_response(&self) -> &PeekPeerResponse {
  567. match self.union {
  568. ::std::option::Option::Some(Message_oneof_union::peek_peer_response(ref v)) => v,
  569. _ => PeekPeerResponse::default_instance(),
  570. }
  571. }
  572. pub fn clear_peek_peer_response(&mut self) {
  573. self.union = ::std::option::Option::None;
  574. }
  575. pub fn has_peek_peer_response(&self) -> bool {
  576. match self.union {
  577. ::std::option::Option::Some(Message_oneof_union::peek_peer_response(..)) => true,
  578. _ => false,
  579. }
  580. }
  581. // Param is passed by value, moved
  582. pub fn set_peek_peer_response(&mut self, v: PeekPeerResponse) {
  583. self.union = ::std::option::Option::Some(Message_oneof_union::peek_peer_response(v))
  584. }
  585. // Mutable pointer to the field.
  586. pub fn mut_peek_peer_response(&mut self) -> &mut PeekPeerResponse {
  587. if let ::std::option::Option::Some(Message_oneof_union::peek_peer_response(_)) = self.union {
  588. } else {
  589. self.union = ::std::option::Option::Some(Message_oneof_union::peek_peer_response(PeekPeerResponse::new()));
  590. }
  591. match self.union {
  592. ::std::option::Option::Some(Message_oneof_union::peek_peer_response(ref mut v)) => v,
  593. _ => panic!(),
  594. }
  595. }
  596. // Take field
  597. pub fn take_peek_peer_response(&mut self) -> PeekPeerResponse {
  598. if self.has_peek_peer_response() {
  599. match self.union.take() {
  600. ::std::option::Option::Some(Message_oneof_union::peek_peer_response(v)) => v,
  601. _ => panic!(),
  602. }
  603. } else {
  604. PeekPeerResponse::new()
  605. }
  606. }
  607. }
  608. impl ::protobuf::Message for Message {
  609. fn is_initialized(&self) -> bool {
  610. if let Some(Message_oneof_union::register_peer(ref v)) = self.union {
  611. if !v.is_initialized() {
  612. return false;
  613. }
  614. }
  615. if let Some(Message_oneof_union::peek_peer(ref v)) = self.union {
  616. if !v.is_initialized() {
  617. return false;
  618. }
  619. }
  620. if let Some(Message_oneof_union::peek_peer_response(ref v)) = self.union {
  621. if !v.is_initialized() {
  622. return false;
  623. }
  624. }
  625. true
  626. }
  627. fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
  628. while !is.eof()? {
  629. let (field_number, wire_type) = is.read_tag_unpack()?;
  630. match field_number {
  631. 6 => {
  632. if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited {
  633. return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
  634. }
  635. self.union = ::std::option::Option::Some(Message_oneof_union::register_peer(is.read_message()?));
  636. },
  637. 7 => {
  638. if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited {
  639. return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
  640. }
  641. self.union = ::std::option::Option::Some(Message_oneof_union::peek_peer(is.read_message()?));
  642. },
  643. 8 => {
  644. if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited {
  645. return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
  646. }
  647. self.union = ::std::option::Option::Some(Message_oneof_union::peek_peer_response(is.read_message()?));
  648. },
  649. _ => {
  650. ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
  651. },
  652. };
  653. }
  654. ::std::result::Result::Ok(())
  655. }
  656. // Compute sizes of nested messages
  657. #[allow(unused_variables)]
  658. fn compute_size(&self) -> u32 {
  659. let mut my_size = 0;
  660. if let ::std::option::Option::Some(ref v) = self.union {
  661. match v {
  662. &Message_oneof_union::register_peer(ref v) => {
  663. let len = v.compute_size();
  664. my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
  665. },
  666. &Message_oneof_union::peek_peer(ref v) => {
  667. let len = v.compute_size();
  668. my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
  669. },
  670. &Message_oneof_union::peek_peer_response(ref v) => {
  671. let len = v.compute_size();
  672. my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
  673. },
  674. };
  675. }
  676. my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
  677. self.cached_size.set(my_size);
  678. my_size
  679. }
  680. fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
  681. if let ::std::option::Option::Some(ref v) = self.union {
  682. match v {
  683. &Message_oneof_union::register_peer(ref v) => {
  684. os.write_tag(6, ::protobuf::wire_format::WireTypeLengthDelimited)?;
  685. os.write_raw_varint32(v.get_cached_size())?;
  686. v.write_to_with_cached_sizes(os)?;
  687. },
  688. &Message_oneof_union::peek_peer(ref v) => {
  689. os.write_tag(7, ::protobuf::wire_format::WireTypeLengthDelimited)?;
  690. os.write_raw_varint32(v.get_cached_size())?;
  691. v.write_to_with_cached_sizes(os)?;
  692. },
  693. &Message_oneof_union::peek_peer_response(ref v) => {
  694. os.write_tag(8, ::protobuf::wire_format::WireTypeLengthDelimited)?;
  695. os.write_raw_varint32(v.get_cached_size())?;
  696. v.write_to_with_cached_sizes(os)?;
  697. },
  698. };
  699. }
  700. os.write_unknown_fields(self.get_unknown_fields())?;
  701. ::std::result::Result::Ok(())
  702. }
  703. fn get_cached_size(&self) -> u32 {
  704. self.cached_size.get()
  705. }
  706. fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
  707. &self.unknown_fields
  708. }
  709. fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
  710. &mut self.unknown_fields
  711. }
  712. fn as_any(&self) -> &dyn (::std::any::Any) {
  713. self as &dyn (::std::any::Any)
  714. }
  715. fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
  716. self as &mut dyn (::std::any::Any)
  717. }
  718. fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
  719. self
  720. }
  721. fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
  722. Self::descriptor_static()
  723. }
  724. fn new() -> Message {
  725. Message::new()
  726. }
  727. fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
  728. static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy {
  729. lock: ::protobuf::lazy::ONCE_INIT,
  730. ptr: 0 as *const ::protobuf::reflect::MessageDescriptor,
  731. };
  732. unsafe {
  733. descriptor.get(|| {
  734. let mut fields = ::std::vec::Vec::new();
  735. fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, RegisterPeer>(
  736. "register_peer",
  737. Message::has_register_peer,
  738. Message::get_register_peer,
  739. ));
  740. fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, PeekPeer>(
  741. "peek_peer",
  742. Message::has_peek_peer,
  743. Message::get_peek_peer,
  744. ));
  745. fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, PeekPeerResponse>(
  746. "peek_peer_response",
  747. Message::has_peek_peer_response,
  748. Message::get_peek_peer_response,
  749. ));
  750. ::protobuf::reflect::MessageDescriptor::new::<Message>(
  751. "Message",
  752. fields,
  753. file_descriptor_proto()
  754. )
  755. })
  756. }
  757. }
  758. fn default_instance() -> &'static Message {
  759. static mut instance: ::protobuf::lazy::Lazy<Message> = ::protobuf::lazy::Lazy {
  760. lock: ::protobuf::lazy::ONCE_INIT,
  761. ptr: 0 as *const Message,
  762. };
  763. unsafe {
  764. instance.get(Message::new)
  765. }
  766. }
  767. }
  768. impl ::protobuf::Clear for Message {
  769. fn clear(&mut self) {
  770. self.union = ::std::option::Option::None;
  771. self.union = ::std::option::Option::None;
  772. self.union = ::std::option::Option::None;
  773. self.unknown_fields.clear();
  774. }
  775. }
  776. impl ::std::fmt::Debug for Message {
  777. fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
  778. ::protobuf::text_format::fmt(self, f)
  779. }
  780. }
  781. impl ::protobuf::reflect::ProtobufValue for Message {
  782. fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
  783. ::protobuf::reflect::ProtobufValueRef::Message(self)
  784. }
  785. }
  786. static file_descriptor_proto_data: &'static [u8] = b"\
  787. \n\rmessage.proto\x12\x03hbb\"$\n\x0cRegisterPeer\x12\x12\n\x08hbb_addr\
  788. \x18\x01\x20\x01(\tB\0:\0\"\x20\n\x08PeekPeer\x12\x12\n\x08hbb_addr\x18\
  789. \x01\x20\x01(\tB\0:\0\"+\n\x10PeekPeerResponse\x12\x15\n\x0bsocket_addr\
  790. \x18\x01\x20\x01(\x0cB\0:\0\"\x9f\x01\n\x07Message\x12,\n\rregister_peer\
  791. \x18\x06\x20\x01(\x0b2\x11.hbb.RegisterPeerH\0B\0\x12$\n\tpeek_peer\x18\
  792. \x07\x20\x01(\x0b2\r.hbb.PeekPeerH\0B\0\x125\n\x12peek_peer_response\x18\
  793. \x08\x20\x01(\x0b2\x15.hbb.PeekPeerResponseH\0B\0B\x07\n\x05union:\0B\0b\
  794. \x06proto3\
  795. ";
  796. static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy {
  797. lock: ::protobuf::lazy::ONCE_INIT,
  798. ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto,
  799. };
  800. fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
  801. ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
  802. }
  803. pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
  804. unsafe {
  805. file_descriptor_proto_lazy.get(|| {
  806. parse_descriptor_proto()
  807. })
  808. }
  809. }